Ball restart velocity and position

Hi, i am having some troubles with ball physics.
When i touch on a button or object my ball is dynamic and the physics are true and physics.setGravity( 0,7 ), and when i touch again on this button or on the object i need to stop the ball at x= 100 and y =200 but i dont want to stop the physics, i change the physics gravity to physics.setGravity( 0,0 ) and
myball.x=100
myball.y= 200
but the ball never stop, she can go to this position and accept my physics gravity, but the movement of the ball dont stop, without stopping physics how i can stop the ball on the position that i need? i need to restart the initial position of my ball

Try setting the ball's linearVelocity to (0,0) when you change the gravity to (0,0) and see if that sorts it out. Let me know.

Peach :)

hi peach thanks for the help, it works, setLinearVelocity (0,0) and stop the movement of the ball but the effect of rotation dont stop, how i can stop the rotation of the ball?
Thanks :)

Hey, no worries :)

ball.isFixedRotation = true will stop it from rotating.

Hi again peach, dont work :S the ball continues rotating

Uh, that was unexpected!

OK, could you try this please;
ball.angularVelocity = 0

If that doesn't work let me know and I'll delve deeper - it has been a little since I've played with this sort of thing but I believe that should fix it.

Peach :)

yeh it works great peach :) thank a lot

Not a problem at all, sorry it took two goes ;)

views:1709 update:2012/2/7 8:40:54
corona forums © 2003-2011