Problem with "bounce" and "transitioning objects"

Hey

I have a bug that I’m trying to work out at the moment which I can’t seem to find a work around yet, so any help would be gratefully appreciated.

Current example :

I have a “ball” object and a “platform” object.
Both the Ball and Platform have physics applied to them and bounce of (eg) 0.5

If the Platform is stationary and the Ball hits it, the ball will bounce as expected.
However, if the Platform is moving then things get weird.

If it moves in any direction OTHER than towards the ball, then the Ball basically “sticks” to the platform until it changes direction at which point it will fly off when the bounce finally kicks in.
I’ve tried with both using “transition.to” and using a timer than manually moves the platform’s x/y axis.
Both have the same bug.

So basically, is there something I can do to get around this problem? I have considered running a Collison trigger and applying a force to the ball instead, but I wasn’t sure if this was a limitation of the Physics engine or something simple I’ve missed?

Any help would be greatly appreciated!

If you need to see any of the code (object creation,etc), then let me know.

[import]uid: 131942 topic_id: 25919 reply_id: 325919[/import]

Can anyone offer any assistance with this? [import]uid: 131942 topic_id: 25919 reply_id: 105049[/import]

Ok, for anyone who might have had similar problems, I have found a work around for now.

I fixed this by adding a “collision” listener to the platform which does the following:


if event.phase == “began” then
if event.other == ball then
transition.to(event.target, { time=1, x=event.target.x, y=event.target.y } )
end
end

What this does is -> for 1 millisecond, transition the platform to where it currently is when the bounce occurs. This means the physics can compute the reaction and outcome of the bounce before telling the platform to carry on with it’s transition once more.

This seems to have fixed my problem.
Cheers! [import]uid: 131942 topic_id: 25919 reply_id: 105158[/import]