Im stuck need to control player and vehicle at the same time !
by Billy L · in Torque Game Engine · 02/07/2003 (1:22 am) · 20 replies
Hi all !
Im stuck !
I need badly to control a vehicle and shoot with the player
at the same time !
Like to stear the vehicle with keys and move the upper part
of the players body to aim and shoot !
anybody got a clue ???
I can control either the vehicle or the player but need to control
both !
My english is not good ,sorry !
Greetings
Billy
Im stuck !
I need badly to control a vehicle and shoot with the player
at the same time !
Like to stear the vehicle with keys and move the upper part
of the players body to aim and shoot !
anybody got a clue ???
I can control either the vehicle or the player but need to control
both !
My english is not good ,sorry !
Greetings
Billy
#2
Thx for the reply ,i dig in to the code hope i find it !
Its a major thing in my game so i really must have this function !
And im no super coder !!!!
Greetings
Billy
02/08/2003 (12:39 am)
Hi Tim !Thx for the reply ,i dig in to the code hope i find it !
Its a major thing in my game so i really must have this function !
And im no super coder !!!!
Greetings
Billy
#3
02/08/2003 (9:15 am)
What you need to do with processTick is forward the Move to the player as well as the vehicle. Only one object can be the 'control object' at one time, and that object is what gets the Move passed to it. All you'd need to do is determine which (player or vehicle) you wanted to be the control object, then in the code for it, forward the moves to the other object by calling processTick( Move * ) on that object.
#4
I got it working with your ideas guys !
But !!!
I made a legvehicle , i took most parts from the player block !
It works but still having problems !
The function i need now !
- is to block so the lower parts of the body dont rotate .
- set a max turning angle on the upper body .
- get the z axis rotation on the player when its mounted to work !
I can do this now
- ride the horse and shoot
- use keys and mouse to stear
- use mouse to aim ( but only sideways )
need moore hints
Billy
02/09/2003 (1:32 am)
HI !I got it working with your ideas guys !
But !!!
I made a legvehicle , i took most parts from the player block !
It works but still having problems !
The function i need now !
- is to block so the lower parts of the body dont rotate .
- set a max turning angle on the upper body .
- get the z axis rotation on the player when its mounted to work !
I can do this now
- ride the horse and shoot
- use keys and mouse to stear
- use mouse to aim ( but only sideways )
need moore hints
Billy
#5
02/09/2003 (10:04 am)
Hmmm. I need a bit more information to help you out. Do you want to use the mouse to rotate the player, and the keyboard to move the horse?
#6
move the horse forward and sidestep with keys ( it works now )
but the mouse movement is a tricky one
i want to aim with player and at the same time stear the vehicle ,so if you make a small adjustment you only aim
and if you make a bigger one it stears the vehicle at the same time .
it works now but i want to lock the player movement to maybe
90 deg so its a limited rotating on the upperpart of the body !
and when you reach the limit angle you stear the vehicle moore .
now the player turns around when i move the mouse and stear the vehicle !
Hope this explonation is enoth !
I keep on digging hehe !
02/09/2003 (11:10 am)
the function im after ismove the horse forward and sidestep with keys ( it works now )
but the mouse movement is a tricky one
i want to aim with player and at the same time stear the vehicle ,so if you make a small adjustment you only aim
and if you make a bigger one it stears the vehicle at the same time .
it works now but i want to lock the player movement to maybe
90 deg so its a limited rotating on the upperpart of the body !
and when you reach the limit angle you stear the vehicle moore .
now the player turns around when i move the mouse and stear the vehicle !
Hope this explonation is enoth !
I keep on digging hehe !
#7
vehicle movement
- forward & backwards ( keys )
- sidestep ( keys )
- mouse button 1 pressed you get the stearing on the mouse
movement.
player movement
- mouse movement turn players upperbody in a limit angle
- mouse button 0 fire
so close to get it work !
02/09/2003 (1:27 pm)
or is it anyway to do this ?vehicle movement
- forward & backwards ( keys )
- sidestep ( keys )
- mouse button 1 pressed you get the stearing on the mouse
movement.
player movement
- mouse movement turn players upperbody in a limit angle
- mouse button 0 fire
so close to get it work !
#8
I can stop the rotation but not limit it !
Made this in the player.cc to stop it
if (move->yaw){
pMove.yaw = 0 ;
}
hope someone got an idea !
02/12/2003 (6:36 am)
the only thing i need now is to limit the yaw rotation on the player when mounted !I can stop the rotation but not limit it !
Made this in the player.cc to stop it
if (move->yaw){
pMove.yaw = 0 ;
}
hope someone got an idea !
#9
if I recall correctly, that function restricts head rotation left and right (among other things)
-Ron
02/12/2003 (1:50 pm)
Have a look at updatemove in player.ccif I recall correctly, that function restricts head rotation left and right (among other things)
-Ron
#10
The above is what TGE uses to limit the head rotating left/right
To make it full 360 (yes, I know you not looking for that. Just posting it as a FYI) replace the above with
-Ron
02/12/2003 (1:52 pm)
more specificlyif (move->freeLook && ((isMounted() && getMountNode() == 0) || (con && !con->is
FirstPerson())))
{
mHead.z = mClampF(mHead.z + y,
-mDataBlock->maxFreelookAngle,
mDataBlock->maxFreelookAngle);
}The above is what TGE uses to limit the head rotating left/right
To make it full 360 (yes, I know you not looking for that. Just posting it as a FYI) replace the above with
mHead.z += y
-Ron
#11
I tried your example it works but the rotation is not smooth enough !
I want the rotation more like the pitch rotation .
I should aim with a gun so it must be smooth !
I must use something with the mRot.z i tested todo another code
it works smooth and real good but only in one direction
if i only could turn this around !!!
F32 y = move->yaw;
if (y > M_PI) y -= M_PI;
mRot.z = mClampF(mRot.z += y,
mDataBlock->minLookAngleMounted,
mDataBlock->maxLookAngleMounted);
-Billy
02/13/2003 (10:31 am)
Hi ron !I tried your example it works but the rotation is not smooth enough !
I want the rotation more like the pitch rotation .
I should aim with a gun so it must be smooth !
I must use something with the mRot.z i tested todo another code
it works smooth and real good but only in one direction
if i only could turn this around !!!
F32 y = move->yaw;
if (y > M_PI) y -= M_PI;
mRot.z = mClampF(mRot.z += y,
mDataBlock->minLookAngleMounted,
mDataBlock->maxLookAngleMounted);
-Billy
#12
02/13/2003 (10:56 am)
turn it around? not following yah
#13
When i use it now it turn only to the right.
from 0 to 40 deg right .
so its only a rotation in one direction !
it's something with the mRot.z and the PI , when i use
the mHead it works but not with the mRot.z.
-Billy
02/13/2003 (11:23 am)
hehe sorry !When i use it now it turn only to the right.
from 0 to 40 deg right .
so its only a rotation in one direction !
it's something with the mRot.z and the PI , when i use
the mHead it works but not with the mRot.z.
-Billy
#14
08/04/2003 (1:17 pm)
Hey, could you please share the code that allows vertical movement and shooting while mounted at a vehicle? I needed this same thing ... Thanx
#15
I havent finnished this yet had alot otherthings todo
but i give it a try later !
you have a resourse to stear the vehicle with keys look
at that one its simular to mine !
But they use the vehicle.cc to make the stearing with keys !
-Billy
08/05/2003 (6:43 am)
Hi SebastiaoI havent finnished this yet had alot otherthings todo
but i give it a try later !
you have a resourse to stear the vehicle with keys look
at that one its simular to mine !
But they use the vehicle.cc to make the stearing with keys !
-Billy
#16
vertical mouse movement and firing to work. I'm fuddling with Player::processTick but nothing yet =P. Okay dude, Thanx. Any help is welcome.
08/07/2003 (11:19 am)
Yeah, I added the resource to steer with keys, but didn't got thevertical mouse movement and firing to work. I'm fuddling with Player::processTick but nothing yet =P. Okay dude, Thanx. Any help is welcome.
#17
when i made this i made the stearing function in the playerblock
not in the vehicle block thats why i could stear and shoot and the same time !
I got it still working but i must dig alittle bit deeper to get it smoother when i aim left and right only.
othervise it works good !
08/07/2003 (4:25 pm)
Sebastiao when i made this i made the stearing function in the playerblock
not in the vehicle block thats why i could stear and shoot and the same time !
I got it still working but i must dig alittle bit deeper to get it smoother when i aim left and right only.
othervise it works good !
#18
08/08/2003 (11:26 am)
I got it working Billy, thanx anyway.
#19
09/29/2004 (5:49 pm)
COOL!why not post it as resource?It is very helpful for everyone.thanks
#20
I know there are some out there that have this working , my source is on ice othervise
i had released this as a resource !
But time is against me :)
09/29/2004 (5:58 pm)
Wow tyg where did you find this thread :)I know there are some out there that have this working , my source is on ice othervise
i had released this as a resource !
But time is against me :)
Torque Owner Tim Gift