Game Development Community

I want jet fighter control

by Andy Hawkins · in Torque Game Engine · 07/19/2007 (4:45 pm) · 2 replies

I'm trying to get my flying vehicle to behave like an agile jetfighter. The roll has got me confused.

If I set rollForce to 4(default I believe), and press right I appear to rudder but I'm actually doing a huge anticlockwise roll (against my real roll)

If I set rollForce to 100 and I press right I roll anticlockwise on the spot, when I should be rolling the other way.

How do I roll like in a jet, ie left = roll anticlockwise, with a quick recentre back to flat flying when I release the controls?

#1
07/19/2007 (5:53 pm)
Maybe it's centre of mass or something? Just adding to my own thread. Any help would be appreciated.
#2
07/21/2007 (12:42 am)
Well it aint jet fighter control but I fixed the rolling issue. rollForce should not be set too high as that's the counter force that rolls you back when you roll in the first place. Here's my datablock so far. Very arcadey - but's that's what I want.


Here's a link to the flyer objects as well...

Flyer

//---------------------------------------------------------------------------------------
// Flying Vehicle Shape File
//---------------------------------------------------------------------------------------
// Vehicle Name: Fighter
// Version: 1.0
 //---------------------------------------------------------------------------------------
datablock FlyingVehicleData(Drone)
{	
	
	spawnOffset						= "0 0 2";
	emap							= true;
	category						= "Vehicles";
	shapeFile						= "~/data/shapes/vehicles/flyer.dts";

	multipassenger					= false;
	computeCRC						= true;
									
	debrisShapeName					= "~/data/shapes/vehicles/flyer.dts";

	// modded by Andy
   collisionTol = 1;
   contactTol = 1;


    drag                      = 0.25;
    density                   = 1.0;

// Mounting Details
    numMountPoints            = 1; // How many mount points you want.
    multipassenger = true;  // Depends on # of mountpoints.
    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;

    mountPose[0] = sitting; // This is the possition linked to the animation sequence name


// Camera Settings
    cameraOffset              = 0;  // Vertical offset from camera mount point
	cameraMaxDist           = 5;
	cameraOffset            = 1.65;
	cameraLag               = 0.0;
    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          = 1.75;    // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
    horizontalSurfaceForce    = 350;   // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
    verticalSurfaceForce      = 100;     // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
    maneuveringForce          = 3400;      // Horizontal jets (W,S,D,A key thrust)
    steeringForce             = 750;         // Steering jets (force applied when you move the mouse)
    steeringRollForce         = 350;      // 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        	= 90;  // 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)                                                                                                                                                                                                                                                                                          // Auto stabilize speed
    vertThrustMultiple        = 3.0;

// Rigid body
    mass                      = 140;        // Mass of the vehicle
    integration               = 2;           // 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        	= 0;      // The speed your contrail shows up at.
    trailEmitter        	= FighterContrailEmitter;
    forwardJetEmitter         = FighterFJetEmitter;
    downJetEmitter        	= FighterDJetEmitter;



    triggerDustHeight         = 4.0;
    dustHeight        		= 1.0;

    damageEmitterOffset[0]	= "0.0 -3.0 0.0 ";
    damageLevelTolerance[0]	= 0.3;
    damageLevelTolerance[1]	= 0.7;
    numDmgEmitterAreas        = 3;
        		
              	
    checkRadius               = 5.5;
    observeParameters         = "0 0 1";
    shieldEffectScale         = "0.937 1.125 0.60";
};