Page 1 of 1

Solved - Working HoverVehicle

Posted: Tue Mar 29, 2016 10:35 pm
by SqHd
I've been banging my head against a wall trying to get past hoverVehicle scripts working in current T3D MIT.
The part I'm stuck on is mounting via collision and the controls (haven't made it to that point yet).
I tried adding the "HoverVehicleData" classname to "scripts/server/player.cs" and even created a "vehicleHover.cs" to mimic the "vehicleWheeled.cs".
The hover vehicle drops in the game fine and I can even bump it around with my player.
Sadly, he can't drive it. I'm trying to use the hoverVehicle as boat (since the watercraft resource hasn't been updated).
Any resources out there? Thanks in advance.

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 3:13 am
by Jason Campbell
Hey SqHd,

try this,

in game/scripts/server

open player.cs

in PlayerData::onCollision function

right after this:
// Mount vehicles  
   if (%col.getType() & $TypeMasks::GameBaseObjectType)  
   {  
      %db = %col.getDataBlock();
add
if ( %obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
           {
      
         // Only mount drivers for now.
         ServerConnection.setFirstPerson(0);
         
         // For this specific example, only one person can fit
         // into a vehicle
         %mount = %col.getMountNodeObject(0);         
         if(%mount)
            return;
         
         // For this specific FPS Example, always mount the player
         // to node 0
         %node = 0;
         %col.mountObject(%obj, %node);
         %obj.mVehicle = %col;
         
      
      }
Should be able to mount it now.

Here is a working hover car for you to look at. There are install instructions included.(note: this is not my code, just am older resource I got working in MIT torque)
https://www.mediafire.com/?paehuce9926sx1e

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 4:25 am
by SqHd
Excellent! Thanks, Jason!
I can now mount the HoverCar... but... it doesn't move :oops:
Any tips on controls?

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 6:07 am
by Jason Campbell
Does the one in the link I posted not move?

Post your datablock here so we can have a look.

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 4:28 pm
by SqHd
Thanks again for taking the time to help! Much appreciated.
The hover vehicle is mountable, but doesn't move (or even seem like it's hovering).
It just sits in the air where I placed it.
Below is the hoverVehicle datablock from the download:
datablock HoverVehicleData(HoverCar)
{
   spawnOffset = "0 0 1";

   floatingGravMag = 55.5;

   category = "Vehicles";
   shapeFile = "art/shapes/vehicles/hoverCar/Cheetah_Body.DAE";
   emap = true;

   maxDamage = 1000.0;
   destroyedLevel = 900.0;
//debrisShapeName = "~/data/shapes/player/GRAVTANK.dts";
//debris = ShapeDebris;
//renderWhenDestroyed = false;

   drag = 0.2;
   density = 0.3;
   hoverHeight = 3;              // Height off the ground at rest     
   createHoverHeight = 3;
   integration = 4;           // Physics integration: TickSec/Rate
   collisionTol = 0.3;        // Collision distance tolerance
   contactTol = 0.2;          // Contact velocity tolerance

   cameraMaxDist = 10.0;
   cameraOffset = 5.7;
   cameraLag = 5.5;

   explosion = HoverExplosion;
   explosionDamage = 0.5;
   explosionRadius = 5.0;

   rechargeRate = 0.7;
   energyPerDamagePoint = 75;
   maxEnergy = 650;
   minJetEnergy = 165;
   jetEnergyDrain = 1.3;

// Rigid Body
   mass = 90;
   bodyFriction = 0.1;
   bodyRestitution = 0.3;
   softImpactSpeed = 20; // Play SoftImpact Sound
   hardImpactSpeed = 28; // Play HardImpact Sound

// Ground Impact Damage (uses DamageType::Ground)
   minImpactSpeed = 29;
   speedDamageScale = 0.10;

// Object Impact Damage (uses DamageType::Impact)
   collDamageThresholdVel = 23;
   collDamageMultiplier = 0.030;

   dragForce = 1.0;
// dragForce = 25 / 45.0;
   vertFactor = 0.8;
   floatingThrustFactor = 0.5;

   mainThrustForce = 600;
   reverseThrustForce = 600;
   strafeThrustForce = 670;
   turboFactor = 1.5;

   brakingForce = 900;
   brakingActivationSpeed = 30;

   stabLenMin = 28.50;
   stabLenMax = 32.50;
   stabSpringConstant = 38;
   stabDampingConstant = 28;

   gyroDrag = 18; // 16
   //gyroForce = 50;
   normalForce = 30;
   restorativeForce = 1600;
   steeringForce = 1000;
   rollForce = 30;
   pitchForce = 30;

   dustEmitter = HoverEmitter;
   triggerDustHeight = 0.5;
   dustHeight = 1.0;
   dustTrailEmitter = HoverEmitter;
   dustTrailOffset = "0.0 -1.0 0.5";
   triggerTrailHeight = 2.6;
   dustTrailFreqMod = 15.0;

   //jetSound = ScoutSqueelSound;
   //engineSound = ScoutEngineSound;
   //floatSound = ScoutThrustSound;
   //softImpactSound = GravSoftImpactSound;
   //hardImpactSound = HardImpactSound;
   //wheelImpactSound = WheelImpactSound;
   maxMountSpeed = 100;
   mountDelay = 100;
   dismountDelay = 1;

   stationaryThreshold = 0.5;
   maxDismountSpeed = 0.1;
   numMountPoints = 2;

   mountPose[0] = "sitting";
   mountPose[0] = sitting;
   mountPointTransform[0] = "0 0 0 0 0 1 0";
   isProtectedMountPoint[0] = false;
   
   //
   softSplashSoundVelocity = 10.0;
   mediumSplashSoundVelocity = 20.0;
   hardSplashSoundVelocity = 30.0;
   exitSplashSoundVelocity = 10.0;

   //exitingWater = VehicleExitWaterSoftSound;
   //impactWaterEasy = VehicleImpactWaterSoftSound;
   //impactWaterMedium = VehicleImpactWaterSoftSound;
   //impactWaterHard = VehicleImpactWaterMediumSound;
   //waterWakeSound = VehicleWakeSoftSplashSound;

   minMountDist = 4;

   damageEmitter[0] = HoverEmitter;
   damageEmitter[1] = HoverEmitter;
   damageEmitter[2] = HoverEmitter;
   damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
   damageLevelTolerance[0] = 0.3;
   damageLevelTolerance[1] = 0.7;
   numDmgEmitterAreas = 2;

   splashEmitter[0] = HoverEmitter;
   splashEmitter[1] = HoverEmitter;

   checkRadius = 1.7785;
   observeParameters = "1 10 10";

    damageEmitter[0] = LightDamageEmitter;
    damageEmitter[1] = HeavyDamageEmitter;
    damageEmitter[2] = DestroyedEmitter;
    damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
    damageLevelTolerance[0] = 0.3;
    damageLevelTolerance[1] = 0.7;
    numDmgEmitterAreas = 1;

    explosion = hoverExplosion;
    //debrisShapeName = "~/data/shapes/explosions/debris.dts";
    //debris = hoverDebris;


   splash = hoverSplash;
   splashVelocity = 4.0;
   splashAngle = 67.0;
   splashFreqMod = 300.0;
   splashVelEpsilon = 0.60;
   bubbleEmitTime = 0.4;
   splashEmitter[0] = hoverFoamDropletsEmitter;
   splashEmitter[1] = hoverFoamEmitter;
   splashEmitter[2] = hoverBubbleEmitter;
   mediumSplashSoundVelocity = 10.0;
   hardSplashSoundVelocity = 20.0;
   exitSplashSoundVelocity = 5.0;

//runningLight[0] = WildcatLight1;
//runningLight[1] = WildcatLight2;
//runningLight[2] = WildcatLight3;

  // shieldEffectScale = "0.9375 1.125 0.6";
};

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 5:14 pm
by Jason Campbell
Darn, ill have to check it tonight. 3.8 has a bug where I cant mount vehicles ill check it in 3.7 and get back to you. I was certain that worked for me . Ill let you know.

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 5:40 pm
by SqHd
Doh! Vehicle bugs... Thanks for checking 3.7. I'll try to test tonight as well.

Re: Working HoverVehicle?

Posted: Wed Mar 30, 2016 11:10 pm
by Jason Campbell
Hey SqHd,

I just tested it and it works fine. Maybe some changes you made to the Vehicle action map? Maybe something when you were trying to get your boat to work?

Try it in a fresh build of 3.8 again.

Re: Working HoverVehicle?

Posted: Thu Mar 31, 2016 12:45 am
by SqHd
Got it working. I deleted the Cheetah cached dts from the folder before starting up the game. Could that have made a difference?
Anyway, thanks so much for the assistance!

Btw, I posted in the Better Collada Exporter topic for you.

Re: Solved - Working HoverVehicle

Posted: Thu Mar 31, 2016 3:22 am
by Jason Campbell
Cool, glad to help.