object & camera

Started by
2 comments, last by tiwummbihaou 20 years ago
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
Advertisement
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.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
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..
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

This topic is closed to new replies.

Advertisement