Curnelious
Curnelious

Reputation: 1

Set Linear Velocity is it really linear? for how much time?

when i do this in cocos2d box2d :

targetBondBody->SetLinearVelocity( b2Vec2(15,4));

what does it means by linear? i know that setImpulse is a power in time 0 ( which mean delta signal ). but linear velocity ,for how much time does he gets this velocity ?

if i want to set a const power on my body- to move in a const velocity, for 2 seconds, how would i do that ? do i have to give it a positive y power to compensate g=9.8 ??

thanks .

Upvotes: 0

Views: 1403

Answers (1)

Andrew
Andrew

Reputation: 24846

targetBondBody->SetLinearVelocity( b2Vec2(15,4)); - it is just changing the current state of the body. This velocity will not be maintained for dynamic body (only if there are no forces at all in the system). You can think about this as the same velocity you can set to the body just after creation. It will then be changed according to the simulation. By default initial velocity is zero.

If you want your body to maintain this velocity - useb2_kinematiсBody.

Upvotes: 2

Related Questions