0
votes

I want to animate my body from 1 position to another position so how it is possible with b2body not CCSprite?

2

2 Answers

1
votes

Only by changing it's linear (and angular if required) velocity by yourself. Changing position instead of velocity will provide incorrect physical behavior in case your body will collide with other bodies. Your body's type should be kinematic in this case too.

0
votes

Andrew is correct. Take a look in b2Body.h. It tells you everything you need to know.

Most often you use either:

void ApplyForce(const b2Vec2& force, const b2Vec2& point);

or:

void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point);