attaching a camera to a bot

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Heizi
Posts: 30
Joined: Mon Oct 10, 2005 11:23 am
Location: Steinach/Baden

attaching a camera to a bot

Post 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?
sober
Posts: 21
Joined: Tue Nov 29, 2005 9:23 am

Post 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.
r3i
Posts: 147
Joined: Wed Jun 29, 2005 10:15 am
Location: Sorrento
Contact:

Post by r3i »

If it solve your question, edit the post title with ( SOLVED ) so others with your question can find our answers ;)
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
Heizi
Posts: 30
Joined: Mon Oct 10, 2005 11:23 am
Location: Steinach/Baden

Post 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.
Guest

Post by Guest »

camera->setTarget(bot->getPosition())

maybe this helps ;)
Heizi
Posts: 30
Joined: Mon Oct 10, 2005 11:23 am
Location: Steinach/Baden

Post 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)
Post Reply