Skip to main content
gamedev.net
🔒 Locked

Some Camera problems

Started by GENTS Jul 10, 2004 at 9:45 AM 4 replies 700+ views
Original Post
GENTS
GENTS
Hi!!! Im working with collisions, theri response, camera and input for a game engine, but I've found a problem that I'm not able to solve... I've implemented a 3D person camera which rotates behind a character and follow him, but it has a problem... When my character stands waiting, my UP key do that he go straight. To rotate him, i press LEFT or RIGHT keys... How can I do that when I've reached the new point of view (the originary right/left) my keyboard react and if I press another time UP key my character go straight and doesn't come back ( turning left/right) ?! INIT: (originary point of view) ^ | ROTATE: (new point of view) - > IF I PRESS UP (NOW) COME BACK TO: ^ | I WANT THAT IF I PRESS UP IT GO STRAIGHT IN THAT DIRECTION: - > - > It's now clear?! I hope 'cause my english is very bad as you can see... Have you got the idea?! Wait for replies... THANKS!!!
Trip99
Trip99
If I understand you, your up should move you in the direction the camera is facing. To do this you need a normalised camera direction vector, then:

// move forward
cameraPosition+=cameraDirection*kSpeed;

// move backward
cameraPosition-=cameraDirection*kSpeed;

To move right and left requires a right vector (you can calculate this easily)
------------------------See my games programming site at: www.toymaker.info
GENTS
GENTS
You've understand perfectly!!!

I've implemented my Camera with your site "tutorial" on 3D person camera!!!

The problem is that I've my camera that is moving around my character, so if I move the character then I move the camera and not the opposite...

In add my direction vector point to the character...
So how can I move the character in the right way?! The problem is in moving the character in the camera direction and not the opposite...

Should I do a sort of circle subdivision and detect the angle of torque of my character and so assign a determinated movement to a key?!

THANKS!!!
Trip99
Trip99
Sorry but I do not quite understand. You want the camera to track the player which is fine but you say you want the player to move in the direction of the camera so I assume your camera is always pointing at the player. Surely then you just move the player by the camera direction? Or do you want to do some slow camera panning onto the character - if you could just expand your explaaation a bit
------------------------See my games programming site at: www.toymaker.info
GENTS
GENTS
My camera turn around my character always pointing to him...

And if I press RIGHT key, my character turn right and the camera look always at my character...
If now I press UP key, it turn left and come back in his original positions instead of going straight as I want to do...

My camera follow always my character so that I can see always his back...

How can I modify my camera class to solve this problem?!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.