Hello,
I'm starting on a new project and I'm hoping to get some advice. So far, I've created mainly first person shooters. This time, I want to make a third person action/adventure type game. The problem right now is the character controls.
I'm not sure how to go about getting the controls the way I'd like them. Basically, I want the character to turn left or right when the corresponding key is held down (obviously). I'd like the character to move forward according to the direction its facing. I don't want the character to move backward, though. If the tries to move the character back, I want the character to turn completely around. So, really I want the character to be facing whatever direction it's moving. I'm not sure the best way to go about all this...
Now, I'm not necessarily asking for code. I'm just looking for some practical ideas on how I can get this to work right.
Thanks!
Basic Thrid Person Character Controller
-
lesPaul456
- Posts: 18
- Joined: Sat Jan 02, 2010 4:48 pm
check out this one.
I think it's pretty much what you want. A rotating camera around a SceneNode and turning/moving to camera direction on key forward.
For strafing or turning you will have to take a look at this very part and just implement more key inputs for doing sideward movement instead of forward.
I think it's pretty much what you want. A rotating camera around a SceneNode and turning/moving to camera direction on key forward.
For strafing or turning you will have to take a look at this very part and just implement more key inputs for doing sideward movement instead of forward.
Code: Select all
if (keys[KEY_KEY_W]){
// player movement vector
vector3df playerStep = sphericalXYZ(cameraOrbit,0,playerMoveSpeed);
playerX -= playerStep.X;
playerY -= playerStep.Y;
playerZ -= playerStep.Z;
(... and more)
Never take advice from someone who likes to give advice, so take my advice and don't take it.
-
lesPaul456
- Posts: 18
- Joined: Sat Jan 02, 2010 4:48 pm