Thoughts on simulating a top-down character
Posted: Tue Nov 11, 2008 3:38 pm
Hello,
I'm working on an action game in the top-down perpective. A small tech video can be found here: http://solidcore.se/splitinput.avi
Now that video is without chipmunk. I've successfully made some chipmunk tests in my engine so its integrated and up and running. Now I want to make that character "physicallized" by moving a circle body around so he can collide with stuff. I'd like to discuss how to handle the physics the best way here and get input from you so I know better what I'm getting into.
Here's what I think. I need 3 things: a force to apply for movement, a rotation to apply for direction and some friction to counteract the movement and stop him when I release my movement buttons.
For movement, should I use applyforce/resetforces every frame or a small impulse as I hold the key?
For rotation, should I have a target angle set by my crosshair and make the character apply rotation until he reaches that angle? Maybe rotation isn't necessary as along as the image is rotated.. what do you think?
For friction, should I somehow apply a reverse force based on the speed in the direction he's moving? Where, how?
Any ideas, tips etc I should think about when using chipmunk for this? Which functions should I look up?
I'm working on an action game in the top-down perpective. A small tech video can be found here: http://solidcore.se/splitinput.avi
Now that video is without chipmunk. I've successfully made some chipmunk tests in my engine so its integrated and up and running. Now I want to make that character "physicallized" by moving a circle body around so he can collide with stuff. I'd like to discuss how to handle the physics the best way here and get input from you so I know better what I'm getting into.
Here's what I think. I need 3 things: a force to apply for movement, a rotation to apply for direction and some friction to counteract the movement and stop him when I release my movement buttons.
For movement, should I use applyforce/resetforces every frame or a small impulse as I hold the key?
For rotation, should I have a target angle set by my crosshair and make the character apply rotation until he reaches that angle? Maybe rotation isn't necessary as along as the image is rotated.. what do you think?
For friction, should I somehow apply a reverse force based on the speed in the direction he's moving? Where, how?
Any ideas, tips etc I should think about when using chipmunk for this? Which functions should I look up?