How to make camera look up/down when player is mounted?
by Joey Skinner · in Technical Issues · 04/17/2006 (7:39 pm) · 9 replies
From what I can tell by testing, every time the player is mounted on a vehicle, TGE restricts the looking up or down. Is this because of the eye node? I can't see anything in the code that makes this restriction.
Does stock TGE actually tie the camera to the mHead structure of the player and they share the same transform data? If that is the case, maybe the vehicles I'm using don't have an eye node which is free to move. How is the eye node tied to the mHead structure?
Help me understand, anyone. Thanks in advance.
Does stock TGE actually tie the camera to the mHead structure of the player and they share the same transform data? If that is the case, maybe the vehicles I'm using don't have an eye node which is free to move. How is the eye node tied to the mHead structure?
Help me understand, anyone. Thanks in advance.
#2
04/18/2006 (7:35 am)
There is a moveMap binding for pitch and yaw. I've put in echo messages and they are definitely being called. But the camera never looks up or down. Yaw does what it is supposed to and steers the vehicle left or right.
#3
Now I haven't had a chance to test this or anything, but I was thinking that something like the player's freelook might be able to do this.
04/18/2006 (8:16 am)
Those bindings are for controlling the pitch and yaw of the vehicle. I'm going to be needing something like this in the future, dealing with physics right now so I can't really test out my theories. I'm planning on most likely mimicing the control scheme in Battlefield 2 where the keyboard controls the vehicle and the mouse will move the view around.Now I haven't had a chance to test this or anything, but I was thinking that something like the player's freelook might be able to do this.
#4
04/18/2006 (8:49 am)
Thanks Scott. From what I can tell from the stock freelook code, it only works in 3rd person. But could probably be modified to work in first person and do what you say. My need is not for a free look, I need it to actually move the "aim" just like it does when not mounted. But I could possibly do what you are thinking of. As long as I can get a direction vector from the freelook camera position. Then I could use that for my aim. I'll look into it.
#5
04/18/2006 (8:58 am)
The stock freelook should work in both first and thrid person. Unless I missed something while testing a head animation a couple months ago, but I'm pretty sure I remember it working in both.
#6
04/18/2006 (9:18 am)
I just went to test the stock fps demo to make sure and the freelook only happens in third person. Unless I'm missing something.
#7
04/18/2006 (9:49 am)
Hm, guess I just remember it wrong then. I was testing the animation when I did it so I was in third person, I guess I must've assumed it worked in first person then. Sorry about that.
#8
setcontrolobject(vehicle)
youll be able to freelook(and shoot) while mounted, but then youre not controlling the vehicle anymore. a dirty workaround for this is to just use setvelocity() for the vehicle to control it externally while mounted. this doesn't work very well and even if you set the velocity using the vehicles current forward vector eventually youll probably get some erratic steering and shifting of the vehicle.
another workaround Ive tried is to mount the player to the vehicle and control it indirectly using an aiplayer object. you can set the vehicle as the aiplayer's control object and then issue movement commands to the aiplayer which, in turn, will control the vehicle. believe it or not this actually works, but not as well as you might like. alot of scripting and this may be a viable solution for you, but probably not.
a small engine modification seems like your best bet for this. i believe there are a few ai vehicle resources that have been submitted pertaining to this.
04/18/2006 (11:19 am)
If you look at player.cs, youll notice that in the oncollision() method, when a player is mounted to a vehicle, the vehicle is also set as the client control object. at this point, any input controls like YAW and PITCH will only be applied to the vehicle...which can't pitch. if you comment out the line similar to:setcontrolobject(vehicle)
youll be able to freelook(and shoot) while mounted, but then youre not controlling the vehicle anymore. a dirty workaround for this is to just use setvelocity() for the vehicle to control it externally while mounted. this doesn't work very well and even if you set the velocity using the vehicles current forward vector eventually youll probably get some erratic steering and shifting of the vehicle.
another workaround Ive tried is to mount the player to the vehicle and control it indirectly using an aiplayer object. you can set the vehicle as the aiplayer's control object and then issue movement commands to the aiplayer which, in turn, will control the vehicle. believe it or not this actually works, but not as well as you might like. alot of scripting and this may be a viable solution for you, but probably not.
a small engine modification seems like your best bet for this. i believe there are a few ai vehicle resources that have been submitted pertaining to this.
#9
Then maybe it's related to pitch.
I can't memorize what yaw, pitch and roll belongs to.
For what I understood, you should best try to build a general movement interface, that will then translate vehicle or player movements from a single keymap.
By the way, I can't help you further because I haven't a so solid understanding about Torque.
Bye, Berserk.
.
04/19/2006 (7:44 am)
Sorry, I'm not very good in memory (neither in english language).Then maybe it's related to pitch.
I can't memorize what yaw, pitch and roll belongs to.
For what I understood, you should best try to build a general movement interface, that will then translate vehicle or player movements from a single keymap.
By the way, I can't help you further because I haven't a so solid understanding about Torque.
Bye, Berserk.
.
Torque Owner Berserk
Try to code a doyaw binding for the vehicle and keep us in touch.
Bye, Berserk.
.