Archived

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

tiwummbihaou

object & camera

Recommended Posts

hi all, i am new here, have a project to accomplish.. i have written a camera and a player class where each generate camera and player.. i want my camera to follow the man where i cannot yet move the man in the direction he looks.. more precisely: i want to move the man where ever he is facing.. i can move him in x or other directions but cannot move him where he faces.. i can move the camera around but cannot make it follow the man.. what shall i do in order to make these work? tnx

Share this post


Link to post
Share on other sites
The moving part is pretty straight forward. Store a vector that points in the direction the man is initially facing. When you rotate the man, rotate the "direction" vector by the same amount. When you want to move the man, move him along the "direction" vector.

Share this post


Link to post
Share on other sites
well the man is facing [0.0,0.0,-1.0] i mean to -z direction..
how can i show this as a vector?
i am quite not familier with these vectors..
how can i learn how to use vectors? do you know some tutorial or very simple sample code for me to look and see?
thank you by the way.. it was a quick answer..

Share this post


Link to post
Share on other sites
this is my favorite 3D math quick reference page:
http://www.geocities.com/SiliconValley/2151/math3d.html

for more in depth tutorials on 3D math (Linear Algebra) look in the Articles & Resources section of this site under the Math section. and just FYI, [0,0,-1,0] _is_ a vector. a vector is just a direction in 3-space. but read the tutorials and it will make more sense.

-me

Share this post


Link to post
Share on other sites