Hi,
I want to rotate a Chipmunk static shape indefinitevely.
How to achieve this? And how control rotation velocity?
Thanks
A fast, easy to use, free, and community supported 2D game engine
Hi,
I want to rotate a Chipmunk static shape indefinitevely.
How to achieve this? And how control rotation velocity?
Thanks
in Box2d there's something named angular velocity. Maybe there's a property around those names?
Yes, there is .. but for active shapes not for static. I must move by hand with cocos2d
coolman, it's the same with static and active shapes. All have the same properties. The problem you have is that you don't add static shapes to the space, right?
So check the step method you use with chipmunk and you'll see something like:
cpSpaceHashEach(space->staticShapes, &eachShape, self);
cpSpaceHashEach(space->activeShapes, &eachShape, self);
As you can see, chipmunk is iterating only through objects from the space. If your shape in not in the space then you'll have to manually update it's position/rotation. What I am doing is something like this:
cpBodyUpdatePosition(body, dt);
cpSpaceRehashStatic(space);
((Sprite *)shape->data).rotation = (float)CC_RADIANS_TO_DEGREES(-body->a);
As for that approach I have to keep my array of static objects by myself, and not to be handled by space.
You must log in to post.