Sign in to follow this  
vivendi

move character with physics

Recommended Posts

I have added physics to my game (made with XNA and JigLibX as physics engine) but now i want to move my character around. Currently i just have a basic game with a terrain and a few boxes spread around the field. These boxes also have physics applied to them. I also load a character in my game with physics applied to it, but my problem is, that i don't know how to make it 'walk' around. I can apply a force to my character, but this way my character will accelerate and de-accelerate when i press and release the movement keys. This is ofcourse good to simulate a car moving around, but not for normal human like characters. So i was wondering how others do it in their game. I don't want my character to slowly accelerate, i want it to move with a constant speed and when i release my keys that it stops immidiately. Anyone any suggestions???

Share this post


Link to post
Share on other sites
Sounds to me like you need bone skinning and animation. making a system that works with the physics to animate the bones in a character is something very complicated. You could just use the physics for collision detection on the character and use skinning and animations to animate it.

Share this post


Link to post
Share on other sites
My character isn't skinned atm and that's not really important right now.

My problem is that i cant/dont know how to make objects which i attached the physics body and skin to move. ( i loaded them, and they collide and everything.) ...

But movement of my character (which is just a box atm) is different with physics on it, because i have to use forces or velocity or anything like that to make it go somewhere. The problem with that is, that it has acceleration.
So it starts slow and goes faster and faster each second. I just want it to have a normal constant speed. So i was hoping that there's a trick / formula to do that with forces/velocity/mass or something like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by vivendi
My character isn't skinned atm and that's not really important right now.

My problem is that i cant/dont know how to make objects which i attached the physics body and skin to move. ( i loaded them, and they collide and everything.) ...

But movement of my character (which is just a box atm) is different with physics on it, because i have to use forces or velocity or anything like that to make it go somewhere. The problem with that is, that it has acceleration.
So it starts slow and goes faster and faster each second. I just want it to have a normal constant speed. So i was hoping that there's a trick / formula to do that with forces/velocity/mass or something like that.


Acceleration is more realistic. Try applying a strong acceleration at the beginning that decreases very fast to 0.

Share this post


Link to post
Share on other sites
Theres lots of ways to do it.

*High acceleration rates (constant acceleration)
*Interpolation (fast take off smooth arrival)
*Animation driven (you control the speed of the animation which has encoded the translation to be applied to the player)

I would lerp the intended speed, feed that into the animation, and use the extracted translation to move the character, bounded by the collision environment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this