First person movement

Started by
4 comments, last by snake5 14 years, 3 months ago
Hello community, I've got a question. Does anybody have an idea, how to calculate movement of a character in an ego shooter? I want to support the same typical movements as quake3 has. Thanks for any help.
My spacesim project blog:http://www.simerge.com/
Advertisement
Do you know vector math? If no, that's the first thing you have to learn. If yes, there should be no problem in calculating movement. :)
P.S. Q3 is open-source.
I know what a vector is. I'm studying math.
And I'm also able to download q3 source. But I prefer first to ask competent people who implemented such "easy things" themselves. And then looking through thousands lines searching for an answer.
My spacesim project blog:http://www.simerge.com/
Quote:I know what a vector is. I'm studying math.
And I'm also able to download q3 source. But I prefer first to ask competent people who implemented such "easy things" themselves. And then looking through thousands lines searching for an answer.
I would agree that looking through the Q3 source would probably not be the easiest way to figure out how to implement basic FPS-style movement :)

So you're familiar with vectors - which part exactly do you need help with? It all really just boils down to some simple trig and vector math, so if you're unsure how to proceed maybe you could tell us which parts you do understand, and which parts you're hung up on.
I just began with the walking routines and met very much problems. To list up what I'm aiming at:
- walking on stairs, slopes
- falling, landing (spring effect when the feets get ground contact)
- Jumping (most interesting is the realization of the acceleration moment before jump)
- Crawling
- Banking of the body when moving
- Friction on rotation and movement

Currently I'm stuck at the airborne situation. I need to distinguish very different cases. The first case is when the player is falling down. In this situation he has no or very little possibilities to influence his movement. Also any friction disappears. Another case occurs when walking downwards at stairs or slopes. The player gets into airborne, but for a very short time. There should be still friction and there should be no restrictions in movement.
Beside this I need the spring effect when landing after a fall which gets in conflict with the second case in my current implementation.

[EDIT]
I'm also unsure how to perform the acceleration moment when jumping.
My spacesim project blog:http://www.simerge.com/
Walking on something is more about collision detection.
You can get a landing effect by shifting the camera when the character lands - you could use "sin( time ) * h" here.
The whole motion should work according to the laws of physics: s=v0*t+a*t*t*0.5;
I haven't seen Q3's jumping but you could split the action into at least 2 parts - whatever happens before that jump goes to the first part and the jump itself could be the second part (although nothing much to do here - just change the velocity)
And what's so special about crawling? It should be easy to make.
The same about banking - change camera's <up> direction (from LookAt) / rotate a 3d model around the axis which goes from back to front.
Friction = gradually decreasing the velocity.
For any axis you can use this: x_velocity -= sign( x_velocity ) * min( q, abs( x_velocity ) );

You really should do more research about this, it's not that hard..

This topic is closed to new replies.

Advertisement