Game Development Community

Controling of a Plane

by Timothy Hansen · in Torque Game Engine Advanced · 09/18/2009 (9:17 am) · 4 replies

How can i change the model of the character to a plane (enter it with e when u stand in front of it or leave it with e), switch the camera view to a 3rd person view and if u move the camera have a little idleness, and control the plane with the mouse(up down spin right/left) and w a s d (up/down left right) and with "shift" thrust.
I know this is very much, but i hope u can help

Thanks in advance

#1
09/18/2009 (1:24 pm)
There's several vehicle resources you would want to check out. One (or more) of them make use of a 'e' to mount method. You may also want to do a search for "Cast Ray Use Button" in the Resources.

Switching to 3rd person is as easy as saying
%this.setFirstPerson(!%this.isFirstPerson());
where %this is the client in question when you mount the vehicle.

For controlling the vehicle you will simply follow the examples of the existing keybinds. Studying up on how to push and pop different keymaps would be of benefit if you need radically different controls between regular players and multiple vehicles. You may also find this resource to be useful if you want the full range of control of flying vehicles. I think you could tweak the values of the various camera settings in the datablock to give the "idle camera" feel I think you're wanting.

The thrust can be done by making sure your vehicle datablock has these energy fields
// Energy  
maxEnergy = 200;
rechargeRate = 0.8;  
jetForce = 20000;  
minJetEnergy = 20;  
jetEnergyDrain = 10;
And then by setting a keybind to 'trigger' the jetting ability which all vehicles can do (even wheeled vehicles)
moveMap.bind(mouse, button1, mouseTurbo);  
  
function mouseTurbo(%val)  
{  
   $mvTriggerCount3++;  
}
#2
09/18/2009 (1:43 pm)
okay thanks a lot, i will try!
#3
09/20/2009 (11:06 am)
So now, i have a shape called "Ship" how can i assign him, that i can enter it and that it has the property of a flying vehicle
#4
09/21/2009 (4:16 am)
You need a flyingvehicle datablock. This will point to your shape and is also where you will setup it's characteristics.