Camera linked to player in vehicle?
by Jaimi McEntire · in Torque Game Engine · 05/20/2009 (7:55 pm) · 8 replies
Is it possible to have the camera linked to the player eye node when the player is mounted in a vehicle? I have an application where I want to animate the player while the player is mounted.
#2
05/22/2009 (10:34 am)
@Daniel - Thanks, that was exactly the push I needed. With a little matrix fun, and some datablock shenanigans, I successfully have the camera at the mounted player.
#3
06/02/2009 (12:05 pm)
@ Jaimie, care to share?
#4
In vehicle::getcameratransform -
1. Pull the matrix for the eye from the mounted item.
2. Pull the matrix for the node you want it mounted to.
3. Multiply them together.
I had to add a position fudge factor to the datablock (and then add it to the eye matrix before multiplication), but you may not need to.
06/02/2009 (6:33 pm)
@deepscratch - I can't share the code, but here's basically how it went:In vehicle::getcameratransform -
1. Pull the matrix for the eye from the mounted item.
2. Pull the matrix for the node you want it mounted to.
3. Multiply them together.
I had to add a position fudge factor to the datablock (and then add it to the eye matrix before multiplication), but you may not need to.
#6
06/03/2009 (6:15 am)
What did the position fudge fix? It seems like those steps should have gotten what you wanted.
#7
06/03/2009 (6:54 am)
@Daniel - it was just due to positions of the nodes in the model being offset a bit.
#8
I understand the theory of what Jaimi said in post #4,
but dont know how to actually code it,
please would someone be able to walk me through the proccess?
I have already freed up the mouse by letting the key keyboard do the steering, and I would realy like to have the players head controlled by the mouses input.
06/16/2009 (12:56 am)
ok, I've been trying to get the same thing working now for a while, with no success.I understand the theory of what Jaimi said in post #4,
but dont know how to actually code it,
please would someone be able to walk me through the proccess?
I have already freed up the mouse by letting the key keyboard do the steering, and I would realy like to have the players head controlled by the mouses input.
Torque Owner Daniel Buckmaster
T3D Steering Committee
I'd look into vehicle::getCameraTransform. Check to see if a player's controlling the vehicle (not sure how you'd want to set this up, but I'm sure it can be done qute simply), and if so, call the player's getCameraTransform instead.