Jump to content
  • Advertisement
Sign in to follow this  
spek

Player movement

This topic is 2830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Pretty basic issue, but rather complex when really thinking about it: how to move your player character? Walking, climbing stairs, swim, walk over a rope, etcetera... There are 4 issues related:"
- Moving the entity matrix
- Animations & synchronizing them: if you climb a ladder, your feet should hit the steps
- Inverse kinematics (walking over slopes/stairs)
- Physics (collide with walls, slide over ice, or bump away objects like boxes)


Smoothly moving a matrix into a certain direction isn't difficult. But synchronizing the animations & physics is. Currently I'm using a physics-driven approach:
- Player has an elipsoid bounding volume
- When moving, the elipsioid is pushed with force (so it nicely does collision detection, bumping away other objects, follow gravity, etcetera).
- Player matrix is copied from the elipsoid matrix (handled by Newton physics engine)

It works, but climbing stairs is difficult (basically the elipsoid collides against each stairstep). Same goes for properly synchronizing the animations (if I take a step of 0.5 meters, there is no way to tell if the physics
engine will actually move it 0.5 meters forward). But even worse, I can't let Newton handle special moves such as climbing a ladder, leaping over a small wall, or hanging on a rope. Well, it is possible in theory, but very nasty.



Another way could be using the animations instead. Let the animation move a central bone forward (or whatever direction) INSIDE the animation itself, then use that motion to move the entity & physical volume. This perfectly synchronizes the animation and allows complex movement. However, animations are not aware of physics such as collisions, friction or gravity... How would a game like, let's say Super Mario, combine all of this? Ok, a little bit more simple then: a shooter?

Cheers

Share this post


Link to post
Share on other sites
Advertisement
Hello,

The Havok engine includes a LOT of samples showing how to use Inverse Kinematics and such. Even if you're using another engine (Newton is an excellent choice btw), you should be able to figure out how to port it.

That's my best guess. I don't know much about game physics.

Share this post


Link to post
Share on other sites
Sounds like a plan Murdock! Downloading right now.

That implies though that physics are used to move the character. Now that is probably true for most games, though I still wonder how special moves are handled. Ladder climbing for example. Or would it be as simple as:
- disable physics (except for some collision detection maybe)
- follow the animation
- when done (normally walking again), activate physics again
?

Thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!