Hello stackoverflow community !
I am trying to figure out how to architect my game using cocos2d.
My problem is that cocos2d's physics engine (i'm talking about chipmunk) lies in a world behind sprites.
When I move the sprite, I'm wondering if I should
*1) be moving it by applying forces on the physics body behind it
OR
2) if i should just simulate movements through code then use physics only when a collision occurs.*
I know you may say that it's up to me. But what was the intended behavior as cocos2d iphone was developed?
I thank you in advance <3
To keep it within the chipmunk system you would apply forces/impulses. There are examples of folks taking control of moving the sprite with their own code, getting the body to follow the sprite then giving control of the body back to the chipmunk simulation.
Quite a few people also just use chipmunk for collision detection and control sprite movement with their own code entirely. This can be done by adding the body to the chipmunk space but not adding the shape to the space.
Here are some discussions on the subject.. I can't post them as hyperlinks because I am a new user..
"http://www.cocos2d-iphone.org/forum/topic/877"
Welcome and good luck!
PS
There is also a way to turn on a Chipmunk mode that gives you a little more freedom over what you can control but at the cost of a more realistic simulation.