Collision Detection Not Consistant
I'm working on a new game while I'm waiting for my previous game to be approved. It's a pinball game. I figured with the way GameSalad handles physics and particle effects, I can create a really nice game. Although, when I actually got to work on the project, it didn't work out as well as anticipated.
It's the flippers.
Basically, I created two rectangles. I set the ball to "collide" with the flippers, but the ball goes through the flippers. When I started this project, I thought the walls would be a problem, but they seem pretty solid. But when I press the button, the ball can go right past the flippers.
I remember this issue from flash. There's a difference between mathematical collision detection and on "hit". (From the way I remember it) if there's a frame rate problem, the ball could skip past the flipper... never actually detecting the hit... which is why mathematical collision can be better for something like this. Is that what's going on here? Is it something else?
I'm using rotate-to-angle for flipper movement. I'm suspecting that the collision detection might be having trouble with the flipper movement. Is this a bug that will be fixed in a future version or am I not doing this correctly?
It's the flippers.
Basically, I created two rectangles. I set the ball to "collide" with the flippers, but the ball goes through the flippers. When I started this project, I thought the walls would be a problem, but they seem pretty solid. But when I press the button, the ball can go right past the flippers.
I remember this issue from flash. There's a difference between mathematical collision detection and on "hit". (From the way I remember it) if there's a frame rate problem, the ball could skip past the flipper... never actually detecting the hit... which is why mathematical collision can be better for something like this. Is that what's going on here? Is it something else?
I'm using rotate-to-angle for flipper movement. I'm suspecting that the collision detection might be having trouble with the flipper movement. Is this a bug that will be fixed in a future version or am I not doing this correctly?
Comments
If you set restitution to 0 for the flipper you may get better collision detection and since you will be using the acceleration behavior and not the actual bounce it should matter.
>> to check for the collision. The idea
>> being that it may not "notice" the
>> collision exactly when it should but
>> in the time that it is overlapping
>> with the flipper there will certainly
>> be some moment when it recognizes
>> the collision and sets the boolean to true.
OK... that's a good theory. I was thinking the same thing... it's not seeing the collision detection. Some backup detection might help, but I'm not quite sure how to implement it.
>> Then have a rule that tells the ball to
>> accelerate in the opposite direction
>> of the flipper. Somehow you will have
>> to figure out the relationship between
>> the angle of the flipper in relation to
>> the ball and then use VectorToAngle
>> in the ball's acceleration.
I'm reading this again. So... a rule... I think you mean that the rule is supposed to go on the ball. I was putting the extra rule on the flipper. I plan to play around with this later today.
I was wondering why I didn't see any GameSalad pinball games. Heh.
The second collision detection helps, but sometimes it still goes right through.
Actor
invisible
movable: false
Rule
When all conditions are true
When button is down
When actor.ball collides or overlaps with self
Then
Collide/Bounce
Then make a separate dummy flipper animation.
This won't give you the varied angles of a mechanical flipper, but it also won't be so sensitive to frame rate. Perhaps a combo of the mechanical and dummy solution would be ideal, using the dummy as a backup. Instead of the ball going through the flipper and the player losing when they shouldn't have, they would just get an odd bounce angle.
I've had the most success with the solution that you presented. Great method! Thank you.