Archived

This topic is now archived and is closed to further replies.

imDivineLight

Chase that camera or get chased yourself

Recommended Posts

Hi! I got my nice graphics core up and running with a range of nice functions. I also have a nice Camera class & a Skinned Mesh class, now i am looking forward to implement camera chasing routines. I move my character and i want that camera to stay behind him(Basically 3rd Person Cam). currently my player is placed infront of my camera. which is acheived by positioning the player on the camera''s position & adding the camera''s direction vector multiplied by a scalar value to character''s position. So whenever my cam moves my character also moves. So this is a character chasing camera, but how to do a camera chasing character. as far as i get, i think i have to add a direction vecter to my character also, which points in which direction my character will move, so then i have to place my camera at the characters position and add the characters dir vec multiplied by a negative scalar? Is it the nice way or there is some other advanced way? Please just make me literate

Share this post


Link to post
Share on other sites
umm... ya, just get your x and z values from the player''s direction vector, you''ll probably want to multiply it by something, and normalize the vector first...

As for your Y, just take your char''s Y plus a static value like 10.0f or 20.0f. You may also want to change your camera up value a bit so it looks at the character not at the horizon.

Share this post


Link to post
Share on other sites
Yeah, ok so i have to calculate and save direction vector in my chars or actors, it''s must i got it, and please tell me it has to be a unit vec or not, & if unit vec then what is the main reason of having a unit vec.

And yes i was having problem my camera was facing horizon, ok so i have to rotate it down on z vector, right!.

Thanks, just one problem with unit vecs, help solve it

Share this post


Link to post
Share on other sites