Jump to content

Solved - Working HoverVehicle


SqHd

Recommended Posts

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.

Edited by SqHd
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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";
};
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...