Help with Flying Vehicle Mounting
by Bobby Leighton · in Torque 3D Professional · 01/14/2014 (11:54 pm) · 6 replies
I have been trying to get the standard Torque player to mount my flying vehicle in the latest MIT build. It has all of the mount nodes that the doc's say that it needs to have, I even put in the ones that don't really need to be there just to make sure they were complete after my first attempts to mount the flyer was unsuccessful. I have looked over the forums, and have tried what seems like everything....I plan on buy a script package that complete things about flying vehicles in the game but I should need it to just be able to mount the right? They still exist or should I go with an earlier version of the engine?
I really could use help with this...my Puddle Jumper needs to Fly!!


I really could use help with this...my Puddle Jumper needs to Fly!!


#2
So I changed the cheetahcar.cs file in art/datablocks/vehicles
Under datablock WheeledVehicleData(CheetahCar)
I added this to the end
Then i changed datablock WheeledVehicleData(CheetahCar) to datablock FlyingVehicleData(CheetahCar)
This makes the cheetah fly on the spot
Then in Player.cs in scripts/server
I changed
to
So you can mount it (You obviously want to modify the original script to check for both WheeledVehicleData and FlyingVehicleData
I haven't been able to go any further as i need to sleep but i believe it's just keybindings that need to be added for thrust (Not sure if you need to add thrusters to the datablock)
So if you can get it to move id say strip out all the stuff from cheetahcar.cs you don't need and use that as your base :)
I would love to see what your final script is in case I do try flying anytime soon :)
01/15/2014 (2:30 am)
I don't have much time as i need to sleep but i just tried to test it out with changing the cheeta file (Probably the worst way to do it but hey i'm new)So I changed the cheetahcar.cs file in art/datablocks/vehicles
Under datablock WheeledVehicleData(CheetahCar)
I added this to the end
// Physics -- following fields commented from several sources on forums, TDN, and FGE drag = 0.2; density = 1.0; minDrag = 50; // Linear Drag (eventually slows you down when not thrusting...constant drag) rotationalDrag = 100; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag) maxAutoSpeed = 300; // Autostabilizer kicks in when less than this speed. (meters / second) autoAngularForce = 15; // Angular stabilizer force (this force levels you out when autostabilizer kicks in) autoLinearForce = 15; // Linear stabilzer force (this slows you down when autostabilizer kicks in) autoInputDamping = 0.95; // Dampen control input so you don't` whack out at very slow speeds maxSteeringAngle = 50; // Max radiens you can rotate the wheel. Smaller number is more maneuverable. horizontalSurfaceForce = 1000; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning) verticalSurfaceForce = 2000; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.) maneuveringForce = 5000; // Horizontal jets (W,S,D,A key thrust) steeringForce = 5000; // Steering jets (force applied when you move the mouse) steeringRollForce = 0; // Steering jets (how much you heel over when you turn) 8 rollForce = 200; // Auto-roll (self-correction to right you after you roll/invert) hoverHeight = 2; // Height off the ground at rest createHoverHeight = 2; // Height off the ground when created jetForce = 100; // Afterburner thrust (this is in addition to normal thrust) minJetEnergy = 0; // Afterburner can't be used if below this threshhold. jetEnergyDrain = 0; // Energy use of the afterburners (lower number is less drain) vertThrustMultiple = 10.0; integration = 3; // Physics integration: TickSec/Rate collisionTol = 1; // Collision distance tolerance contactTol = .5; // Contact velocity tolerance mass = 50; // Mass of the vehicle bodyFriction = 0; // Don't change this. bodyRestitution = 0.2; // When you hit the ground, how much you rebound. (between 0 and 1) minRollSpeed = 0; // Don't change this.
Then i changed datablock WheeledVehicleData(CheetahCar) to datablock FlyingVehicleData(CheetahCar)
This makes the cheetah fly on the spot
Then in Player.cs in scripts/server
I changed
if ((%db.getClassName() $= "WheeledVehicleData" ) && %obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
to
if ((%db.getClassName() $= "FlyingVehicleData" ) && %obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
So you can mount it (You obviously want to modify the original script to check for both WheeledVehicleData and FlyingVehicleData
I haven't been able to go any further as i need to sleep but i believe it's just keybindings that need to be added for thrust (Not sure if you need to add thrusters to the datablock)
So if you can get it to move id say strip out all the stuff from cheetahcar.cs you don't need and use that as your base :)
I would love to see what your final script is in case I do try flying anytime soon :)
#3
01/15/2014 (7:47 am)
Wow nice! I am not sure what I did wrong, as I tried to make my vehicle fly in this way, but I followed your instructions anyway and it worked so I wont question it lol! THank you, and yeah once it does more that just let me mount Ill post back when actually flying;O)
#4
When is it released?
It looks really cool! Exactly like the Ancient would have wanted it to look! :P
01/15/2014 (11:18 am)
PUDDLE JUMPERS! I MUST PLAY YOUR GAME!When is it released?
It looks really cool! Exactly like the Ancient would have wanted it to look! :P
#5
God I wish they actually made the stargate game that got cancelled.
But seriously I love this model it looks fantastic :D
But Bobby I could get movement this morning kinda
I Think I just created a new flying class in the editor window and linked to the cheetah datablock which lets me move back and forth and the model rotates left and right (Does a full circle if you keep holding down the button) I didn't see any way to move up and down though it looked like i could with the mouse but i had a trackpad so it didn't move very much but that sounds like it might be just a tweaking of the settings for control :)
Love to see an update of this when you get a chance and if the above worked.
01/15/2014 (4:25 pm)
This would be awesome an ancient comes down and tells you the galaxy is about to be taken over by replicators and it falls to your hands to help then they get dragged up by the other ancients cause of interfering (Or it could be like the ancient that was banished to a world?) and you need to use the puddle jumper and cloaking to bomb the replicators a simple but awesome idea then once your cleared out the section you ring to a new world :DGod I wish they actually made the stargate game that got cancelled.
But seriously I love this model it looks fantastic :D
But Bobby I could get movement this morning kinda
I Think I just created a new flying class in the editor window and linked to the cheetah datablock which lets me move back and forth and the model rotates left and right (Does a full circle if you keep holding down the button) I didn't see any way to move up and down though it looked like i could with the mouse but i had a trackpad so it didn't move very much but that sounds like it might be just a tweaking of the settings for control :)
Love to see an update of this when you get a chance and if the above worked.
#6
Go to the World Editor
Press F6 for the Datablock editor
Click on the New Tab
Select Flying Vehicle Data and double click
Create the name you want for it then select the Cheetah datablock
Now you can add the vehicle into the world the same as you do with the cheetah it will be under object editor (F1) then Library and in that list under the vehicles folder.
Now once you touch it you will mount and then pressing forward and backwards moves back and forth and the mouse moves up and down and side to side (It takes a long movement to move up and down and to the side so you need to tweak the settings for the steering it seems)
The only issue is turning is very odd it rotates in a circular direction like it's rotating around a invisible cylinder
01/15/2014 (5:57 pm)
Ok just tried it quickly at work :)Go to the World Editor
Press F6 for the Datablock editor
Click on the New Tab
Select Flying Vehicle Data and double click
Create the name you want for it then select the Cheetah datablock
Now you can add the vehicle into the world the same as you do with the cheetah it will be under object editor (F1) then Library and in that list under the vehicles folder.
Now once you touch it you will mount and then pressing forward and backwards moves back and forth and the mouse moves up and down and side to side (It takes a long movement to move up and down and to the side so you need to tweak the settings for the steering it seems)
The only issue is turning is very odd it rotates in a circular direction like it's rotating around a invisible cylinder
Torque Owner Bobby Leighton
Imagn' Games
datablock FlyingVehicleData(PuddleJumper)
{
category = "Vehicles"; // category for the editor
shapeFile = "art/shapes/puddleJumper/puddleJumper.DAE";
createHoverHeight = 20;
// 3rd person camera settings
cameraRoll = true;
cameraMaxDist = 16;
cameraOffset = 1.0;
cameraLag = 0.1;
cameraDecay = 1.25;
// Rigid Body
mass = 100;
massCenter = "0 -0.2 0";
massBox = "0 0 0";
integration = 3;
collisionTol = 0.6;
contactTol = 0.4;
bodyFriction = 0;
bodyRestitution = 0.8;
minRollSpeed = 2000;
minImpactSpeed = 5;
softImpactSpeed = 3;
hardImpactSpeed = 15;
drag = 0.25;
minDrag = 40;
rotationalDrag = 20;
// Autostabilizer
maxAutoSpeed = 6;
autoAngularForce = 400;
autoLinearForce = 300;
autoInputDamping = 0.55;
// Maneuvering
maxSteeringAngle = 3;
horizontalSurfaceForce = 20;
verticalSurfaceForce = 20;
maneuveringForce = 6400;
steeringForce = 500;
steeringRollForce = 200;
rollForce = 10;
hoverHeight = 0.5;
createHoverHeight = 0.5;
maxForwardSpeed = 90;
// Vertical jetting
maxEnergy = 100;
jetForce = 3000;
minJetEnergy = 28;
jetEnergyDrain = 2.8;
vertThrustMultiple = 3.0;
// Emitters
forwardJetEmitter = FighterJettingEmitter;
backwardJetEmitter = FighterJettingEmitter;
downJetEmitter = FighterJettingEmitter;
trailEmitter = FighterContrailEmitter;
minTrailSpeed = 10;
// Sounds
engineSound = FighterEngineSnd;
jetSound = FighterJettingSnd;
};
// This function is executed when the FlyingVehicle object is added to the simulation.
function puddleJumper::onAdd( %this, %obj )
{
Parent::onAdd( %this, %obj );
// Allow jetting energy to recharge over time
%obj.setRechargeRate( 2 );
}
At this point I just need to be able to mount and take off. I figure I can play with all of the controls to smooth things out so I can get all of my art in place, as that is mostly what I am building...an interactive portfolio that is a game.