# 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.

## 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 on other sites
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 on other sites

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)
- when done (normally walking again), activate physics again
?

Thanks

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633659
• Total Posts
3013210
×

## Important Information

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!