Getting an animated mesh to follow camera?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Spartacus
Posts: 70
Joined: Fri Nov 21, 2003 11:56 pm

Getting an animated mesh to follow camera?

Post by Spartacus »

I am trying to figure out a way to put a character on the screen so he follows the camera as i walk you know? like in some games how you can see the character walking though the 3d world is this posisble yet? if so any info?
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post by Boogle »

Do you mean a 3rd person view, like Tomb Raider, or other such games? If so, you'd want the camera to follow the mesh, not the other way around. Each loop update the position of the camera so it is somewhere behind your mesh (or wherever you want it).
Spartacus
Posts: 70
Joined: Fri Nov 21, 2003 11:56 pm

Post by Spartacus »

how would i set the models position like with the camera following?
like what code? 0.o
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post by qwe »

I think you would set something in the main event loop that 1. gets the position of the mesh, 2. sets the camera a ways behind it, 3. does camera->setTarget(mesh->getPosition());

you may also want to put a collision detector on the camera so it doesn't go wandering into walls etc. :)
Keanu

Maybe I can help

Post by Keanu »

You can specify your mesh attached at a scene node as the parent of the camera when you create it so when you move the mesh the camera follows. I tried it but it makes some jokes. I think is a library problem but try it out aniway.
Post Reply