Page 1 of 1

attaching a camera to a bot

Posted: Thu Dec 01, 2005 8:14 am
by Heizi
I have made some bots that can move around waypoints.
But how can I attach a camera to them that moves and rotates with them????
I have already used addchild, but the camera only moved with the bot,
but she didnt rotate. Does anyone know how to do that?

Posted: Thu Dec 01, 2005 8:37 am
by sober
Take a matrix, put the bots rotation and transformation on it, move the matrix alittle bit backwards and put the rotation and position to your camera.

Posted: Thu Dec 01, 2005 8:38 am
by r3i
If it solve your question, edit the post title with ( SOLVED ) so others with your question can find our answers ;)

Posted: Thu Dec 01, 2005 11:09 am
by Heizi
I dont thik that this will work because basically its the same as addchild
does automtacally. Normally addchild supports rotating too, but the problem is
that the camera always looks at a fixed point, it doesnt matter what camera type I use.
Thanks for your suggestion anyway, I ll give it a try.

Posted: Thu Dec 01, 2005 11:25 am
by Guest
camera->setTarget(bot->getPosition())

maybe this helps ;)

Posted: Mon Dec 05, 2005 8:56 am
by Heizi
Thanks for your answers!
Finally it works with how the guest suggested. I havent
tried the other method, because it seemed more difficult, but it could
be that it would also work. Additionaly, I had to intialize the position
of the cam not where the bot was, but somewhere next to it (for
all those people who want to solve a similar problem)