jump using setLinearVelocity.

Hello Guys,

I want to know about setLinearVelocity.

In setLinearVelocity vx and vy is velocity pixel per second but its jump is not same as its velocity .

ex. setLinearVelocity(0,-200)

then character have to up 200 pixel right ? but its dont up 200 pixels.

Can you please explain how can i do it best?

Thank You.

Savan.

Hi @panarasavan,

Setting linear velocity does not specify that the object should move exactly “x” or “y” pixels in a direction… it simply sets the linear velocity in that direction, at pixels per second.

Normally, jumping is better handled by apply a linear impulse or force, which is like “kicking” the object in a direction:

https://docs.coronalabs.com/api/type/Body/applyLinearImpulse.html

https://docs.coronalabs.com/api/type/Body/applyForce.html

Take care,

Brent

check out this great tutorial.
http://thatssopanda.com/corona-sdk-tutorials/making-a-character-jump-in-corona-sdk/

Hi @panarasavan,

Setting linear velocity does not specify that the object should move exactly “x” or “y” pixels in a direction… it simply sets the linear velocity in that direction, at pixels per second.

Normally, jumping is better handled by apply a linear impulse or force, which is like “kicking” the object in a direction:

https://docs.coronalabs.com/api/type/Body/applyLinearImpulse.html

https://docs.coronalabs.com/api/type/Body/applyForce.html

Take care,

Brent

check out this great tutorial.
http://thatssopanda.com/corona-sdk-tutorials/making-a-character-jump-in-corona-sdk/