Flying vehicle stuck on ground
by __._ · in Torque Game Engine · 05/05/2007 (2:03 am) · 12 replies
I have modified the racing starterkit to a flying game, but now that I'm working on the intro, the player should stay grounded until he/she is cleared for take-off. However, after spawning the player just above the ground the model slowly lowers itself to actually stand still on the ground. Once it did, it freezes. It can no longer be controlled.
To test if I made an error in code somewhere I changed the original racing starterkit again to only be a flying vehicle instead of a racing vehicle, but even there it freezes after it sets down on the ground.
How can I spawn the player steadily on the ground, without having to drop down the last bit?
How can I prevent the player from freezing?
Thanks in advance
To test if I made an error in code somewhere I changed the original racing starterkit again to only be a flying vehicle instead of a racing vehicle, but even there it freezes after it sets down on the ground.
How can I spawn the player steadily on the ground, without having to drop down the last bit?
How can I prevent the player from freezing?
Thanks in advance
#2
I am wondering how to use
function clientCmdPopActionMap(){ echo("Popping Player action map " ); movemap.pop();}
function clientCmdPushActionMap(){ echo("Pushing Player action map " ); movemap.push();}
I hoped it would result in my player being unable to move or accelerate, but it didn't do anything for me. How did you do this?
05/05/2007 (3:31 am)
No for the test I used an unmodified version that's installed by the installer. I checked your resource but couldn't see any code to fix it. I currently set the player speed to 0.1, which prevents the freezing, but I'd prefer not to move at all.I am wondering how to use
function clientCmdPopActionMap(){ echo("Popping Player action map " ); movemap.pop();}
function clientCmdPushActionMap(){ echo("Pushing Player action map " ); movemap.push();}
I hoped it would result in my player being unable to move or accelerate, but it didn't do anything for me. How did you do this?
#3
If you want to disable movement I'd recommend using the "disableMove" method as opposed to popping the actionMap.
05/05/2007 (4:13 am)
Those commands are used to 'pop' and 'push' different action maps. In other words, you can define a different set of keybindings to be used in certain scenarios. In my helicopter resource, I use the standard keyboard controls for the player and have defined a new set for the helicopter.If you want to disable movement I'd recommend using the "disableMove" method as opposed to popping the actionMap.
#4
The thread is located here: http://www.garagegames.com/mg/forums/result.thread.php?qt=61576
05/05/2007 (4:18 am)
I've tried that (there's another thread on that) but it won't work.The thread is located here: http://www.garagegames.com/mg/forums/result.thread.php?qt=61576
#5
I haven't used flyingVehicles for a while, heck I haven't even used Torque recently. I've pretty much reached the end of my usefulness to you, hopefully someone else will chime in and help you out.
05/05/2007 (4:24 am)
Thought your name was familiar :)I haven't used flyingVehicles for a while, heck I haven't even used Torque recently. I've pretty much reached the end of my usefulness to you, hopefully someone else will chime in and help you out.
#6
05/07/2007 (10:52 am)
Is your ground terrain or a .dif or .dts? If its a .dts your vehicle collision might be sinking into the ground a bit. I had a problem like this once. Use a .dif or the terrain as .dts has collision issues.
#7
05/07/2007 (11:51 am)
It's normal terrain at the moment. I can try using a DIF but unfortunately I can't try it right now, so results will be pending :)
#8
05/07/2007 (12:13 pm)
Normal terrain should be fine. What does your datablock look like? I've read 'bodyRestitution' should be less than 1 (try 0.4), not sure if that will help.
#9
05/07/2007 (12:16 pm)
The value you mentioned is set to 0.8. This code is almost a straight copy-paste from the tutorial on TDN.//-----------------------------------------------------------------------------
// Flying Vehicle Shape File
//-----------------------------------------------------------------------------
datablock FlyingVehicleData(UitvindersToestel)
{
spawnOffset = "0 0 2";
emap = true;
category = "Player";
shapeFile = "~/data/shapes/buggy/buggy.dts"; // Shape File
//shapeFile = "~/data/shapes/vliegtuig/vliegtuig.dts"; // Shape File
multipassenger = false;
computeCRC = true;
//debrisShapeName = "~/data/shapes/vehicles/tkfighter_debris.dts";
//debris = FighterShapeDebris;
//renderWhenDestroyed = false;
drag = 0.25;
density = 1.0;
// Mounting Details
numMountPoints = 1;
maxMountSpeed = 0.1;
mountDelay = 8;
dismountDelay = 1;
stationaryThreshold = 0.5;
maxDismountSpeed = 0.1;
mountPose[0] = "Sitting";
mountPointTransform[0] = "0 0 0 0 0 1 0";
isProtectedMountPoint[0] = false;
minMountDist = 2;
// Camera Settings
cameraOffset = 1.5; // Vertical offset from camera mount point
cameraMaxDist = 16;
cameraOffset = 3.65;
cameraLag = 0.1;
cameraRoll = false; // Roll the camera with the vehicle
// Explosions = FighterVehicleExplosion; // Particle Data?
explosionDamage = 10.5;
explosionRadius = 15.0;
maxDamage = 50.40;
destroyedLevel = 50.40;
// Afterburner and any energy weapon pool
energyPerDamagePoint = 160;
maxEnergy = 280;
rechargeRate = 0.8;
minDrag = 40; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 20; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 10; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 400; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.55; // Dampen control input so you don't' whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 2; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 20; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 20; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 6400; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 500; // Steering jets (force applied when you move the mouse)
steeringRollForce = 200; // Steering jets (how much you heel over when you turn)
rollForce = 10; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 0.5; // Height off the ground at rest
createHoverHeight = 0.5; // Height off the ground when created
maxForwardSpeed = 30; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 3000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 28; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 2.8; // Energy use of the afterburners (low number is less drain...can be fractional)
vertThrustMultiple = 3.0; // Auto stabilize speed
// Rigid body
mass = 100; // Mass of the vehicle
integration = 3; // Physics integration: TickSec/Rate
collisionTol = 0.6; // Collision distance tolerance
contactTol = 0.4; // Contact velocity tolerance
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.8; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 2000; // Don't mess with this.
softImpactSpeed = 3; // Sound hooks. This is the soft hit.
hardImpactSpeed = 15;// Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 10; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
// Contrails
minTrailSpeed = 15; // The speed your contrail shows up at.
trailEmitter = FighterContrailEmitter;
forwardJetEmitter = FighterFJetEmitter;
downJetEmitter = FighterDJetEmitter;
//Sounds
jetSound = FighterThrustSound;
engineSound = FighterEngineSound;
//softImpactSound = FighterSoftImpactSound;
//hardImpactSound = FighterHardImpactSound;
//softSplashSoundVelocity = 10.0;
//mediumSplashSoundVelocity = 15.0;
//hardSplashSoundVelocity = 20.0;
//exitSplashSoundVelocity = 10.0;
//exitingWater = FighterExitWaterMediumSound;
//impactWaterEasy = FighterImpactWaterSoftSound;
//impactWaterMedium = FighterImpactWaterMediumSound;
//impactWaterHard = FighterImpactWaterMediumSound;
//waterWakeSound = FighterWakeMediumSplashSound;
// dustEmitter = FighterLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 1.0;
// damageEmitter[0] = LightDamageSmoke;
// damageEmitter[1] = HeavyDamageSmoke;
// damageEmitter[2] = MediumDamageSmoke;
damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 3;
// Weapons and Ammo
//max[RocketAmmo] = 1000;
//splashEmitter[0] = VehicleFoamDropletsEmitter;
//splashEmitter[1] = VehicleFoamEmitter;
//shieldImpact = VehicleShieldImpact;
//cmdCategory = "Tactical";
//cmdIcon = CMDFlyingScoutIcon;
//cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
//targetNameTag = 'Fighter';
//targetTypeTag = 'FlyingVehicle';
//sensorData = AWACPulseSensor;
//sensorRadius = AWACPulseSensor.detectRadius;
//sensorColor = "255 194 9";
checkRadius = 5.5;
observeParameters = "0 0 1";
shieldEffectScale = "0.937 1.125 0.60";
};
function FlyingVehicleData::create(%block)
{
%obj = new FlyingVehicleData() {
dataBlock = %block;
};
return(%obj);
}
#10
05/07/2007 (9:59 pm)
Try changing hoverHeight to .8 or more just to test, it sounds like its stuck in the ground.
#11
05/08/2007 (12:13 am)
That pretty much did it! Thank you.
#12
05/08/2007 (7:42 am)
No prob, glad to help :)
Torque Owner Tim Heldna
I noticed this problem with my heliVehicle (based off of a flyingVehicle) when using that compiler however compiling in vc6 does not present this problem.
Check my profile for my helicopter resource, there are a few tips & tricks in there to help eliminate this problem.