Player's animation when mounted to a vehicle.
by Chris Newman · in Torque Game Engine · 02/28/2005 (7:57 pm) · 5 replies
How much control of the player's animation and weapon firing do you have when he is mounted to a vehicle?
For example in my game I want a wizard running around throwing fireballs at bad guys. Then along comes another wizard flying on a magic carpet. I then kick his butt with my fireballs and jump on his carpet. Now I want to fly around on this carpet and still fling my fireballs.
A huge dragon comes around and I kick his butt and ditch my measly carpet to ride on the dragon. I still want to fling my fireballs.
So the real question is if im mounted to a vehicle and want to fire my player's weapons can I tell the vehicle to trigger my player's actions so he can still use his spells and attack? Because as far as I know once you are mounted to a vehicle you are the vehicle until you unmount.
At first all I was going to do was code the player to fly and mount the carpet on his feet. This would allow me full control of my player still.
But now I want to be able to ride creatures and that idea won't work very well, unless I code the player to fly differently for each type of thing he is riding and i dont want to do that cuz it just sounds like a bad idea. I would rather just mount the vehicles.
For example in my game I want a wizard running around throwing fireballs at bad guys. Then along comes another wizard flying on a magic carpet. I then kick his butt with my fireballs and jump on his carpet. Now I want to fly around on this carpet and still fling my fireballs.
A huge dragon comes around and I kick his butt and ditch my measly carpet to ride on the dragon. I still want to fling my fireballs.
So the real question is if im mounted to a vehicle and want to fire my player's weapons can I tell the vehicle to trigger my player's actions so he can still use his spells and attack? Because as far as I know once you are mounted to a vehicle you are the vehicle until you unmount.
At first all I was going to do was code the player to fly and mount the carpet on his feet. This would allow me full control of my player still.
But now I want to be able to ride creatures and that idea won't work very well, unless I code the player to fly differently for each type of thing he is riding and i dont want to do that cuz it just sounds like a bad idea. I would rather just mount the vehicles.
#2
03/15/2005 (11:56 am)
Has anyone done this before?
#3
It's not that hard, actually. Look at Player::processTick. There's one if there that deals with the control differently if the Player is mounted to something.
03/17/2005 (2:30 pm)
Robert got it working on his horse pack.It's not that hard, actually. Look at Player::processTick. There's one if there that deals with the control differently if the Player is mounted to something.
#4
03/17/2005 (3:23 pm)
I've looked into this and I was just curious what the variables pMove and cMove actually represent? I know they're the movement information but which is which? cMove == Control Object and pMove == Player Object or what?
#5
If you read through the code, you'll see that, when the player is mounted to something, it will copy some information from move into cMove and pMove, then it'll call processTick on the control object and send cMove, and then will use pMove for itself.
03/18/2005 (6:27 am)
The cMove is the move that'll be forwarded to the control object (the vehicle), and pMove will be the move that'll be used by the player itself.If you read through the code, you'll see that, when the player is mounted to something, it will copy some information from move into cMove and pMove, then it'll call processTick on the control object and send cMove, and then will use pMove for itself.
Associate Manoel Neto
Default Studio Name
You'll need to modify the engine to allow firing while mounted, since right now the player forwards the move information to the vehicle and clears it's own move information, in the processTick function.
Probably you can get things to work if you don't clear all of the move information after copying it to the control object.