//----------------------------------------------------------------------------- // Torque Game Engine // // Copyright (c) 2001 GarageGames.Com // Portions Copyright (c) 2001 by Sierra Online, Inc. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Information extacted from the shape. // // Wheel Sequences // spring# Wheel spring motion: time 0 = wheel fully extended, // the hub must be displaced, but not directly animated // as it will be rotated in code. // Other Sequences // steering Wheel steering: time 0 = full right, 0.5 = center // breakLight Break light, time 0 = off, 1 = breaking // // Wheel Nodes // hub# Wheel hub, the hub must be in it's upper position // from which the springs are mounted. // // The steering and animation sequences are optional. // The center of the shape acts as the center of mass for the car. //----------------------------------------------------------------------------- datablock AudioProfile(CarEngineSound) { filename = "~/data/sound/car_idle.wav"; description = AudioDefaultLooping3d; preload = true; }; datablock ParticleData(TireParticle) { textureName = "~/data/shapes/vehicles/example1/dustParticle"; dragCoefficient = 5.0; gravityCoefficient = -0.1; inheritedVelFactor = 0.5; constantAcceleration = 0.0; lifetimeMS = 1000; lifetimeVarianceMS = 0; colors[0] = "0.46 0.36 0.26 1.0"; colors[1] = "0.46 0.46 0.36 0.0"; sizes[0] = 0.50; sizes[1] = 1.0; }; datablock ParticleEmitterData(TireEmitter) { ejectionPeriodMS = 10; periodVarianceMS = 0; ejectionVelocity = 1; velocityVariance = 1.0; ejectionOffset = -5.0; thetaMin = 5; thetaMax = 20; phiReferenceVel = 0; phiVariance = 360; overrideAdvances = false; particles = "TireParticle"; }; //---------------------------------------------------------------------------- datablock WheeledVehicleTire(Example1TireRear) { // Tires act as springs and generate lateral and longitudinal // forces to move the vehicle. These distortion/spring forces // are what convert wheel angular velocity into forces that // act on the rigid body. shapeFile = "~/data/shapes/vehicles/example1/wheel.dts"; //friction = 1.5; friction = 6.5; // Spring that generates lateral tire forces lateralForce = 6000; lateralDamping = 400; lateralRelaxation = 1; // Spring that generates longitudinal tire forces longitudinalForce = 6000; longitudinalDamping = 400; longitudinalRelaxation = 1; }; datablock WheeledVehicleTire(Example1TireFront) { // Tires act as springs and generate lateral and longitudinal // forces to move the vehicle. These distortion/spring forces // are what convert wheel angular velocity into forces that // act on the rigid body. shapeFile = "~/data/shapes/vehicles/example1/wheel.dts"; //friction = 1.5; friction = 6.5; // Spring that generates lateral tire forces lateralForce = 6000; lateralDamping = 400; lateralRelaxation = 1; // Spring that generates longitudinal tire forces longitudinalForce = 6000; longitudinalDamping = 400; longitudinalRelaxation = 1; }; datablock WheeledVehicleSpring(Example1SpringRear) { // Wheel suspension properties length = 0.90; // Suspension travel force = 3000; // Spring force damping = 600; // Spring damping antiSwayForce = 3; // Lateral anti-sway force }; datablock WheeledVehicleSpring(Example1SpringFront) { // Wheel suspension properties length = 0.90; // Suspension travel force = 3000; // Spring force damping = 1200; // Spring damping antiSwayForce = 3; // Lateral anti-sway force }; datablock WheeledVehicleData(Example1) { category = "Vehicles"; shapeFile = "~/data/shapes/vehicles/example1/example1.dts"; emap = true; // -- Adrian mountPose[0] = sitting; numMountPoints = 1; isProtectedMountPoint[0] = true; // ------------- maxDamage = 1.5; destroyedLevel = 1.0; maxSteeringAngle = 0.785; // Maximum steering angle, should match animation integration = 4; // Force integration time: TickSec/Rate tireEmitter = TireEmitter; // All the tires use the same dust emitter // 3rd person camera settings cameraRoll = false; // Roll the camera with the vehicle cameraMaxDist = 6; // Far distance from vehicle cameraOffset = 2.5; // Vertical offset from camera mount point cameraLag = 0.1; // Velocity lag of camera cameraDecay = 0.75; // Decay per sec. rate of velocity lag // Rigid Body mass = 200; drag = 0.6; bodyFriction = 0.6; bodyRestitution = 0.4; minImpactSpeed = 5; // Impacts over this invoke the script callback softImpactSpeed = 5; // Play SoftImpact Sound hardImpactSpeed = 15; // Play HardImpact Sound // Engine engineTorque = 5000; // Engine power engineBrake = 600; // Braking when throttle is 0 brakeTorque = 2000; // When brakes are applied maxWheelSpeed = 55; // Engine scale by current speed / max speed // Energy maxEnergy = 100; jetForce = 3000; minJetEnergy = 30; jetEnergyDrain = 2; // Sounds // jetSound = ScoutThrustSound; // engineSound = ScoutEngineSound; engineSound = CarEngineSound; // squealSound = ScoutSquealSound; // softImpactSound = SoftImpactSound; // hardImpactSound = HardImpactSound; // wheelImpactSound = WheelImpactSound; // explosion = VehicleExplosion; }; //----------------------------------------------------------------------------- function WheeledVehicleData::create(%block) { %obj = new WheeledVehicle() { dataBlock = %block; }; // Adrian %obj.mountable = true; return(%obj); } //----------------------------------------------------------------------------- function WheeledVehicleData::onAdd(%this,%obj) { // Setup the car with some defaults tires & springs //for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) { // %obj.setWheelTire(%i,Example1Tire); // %obj.setWheelSpring(%i,Example1Spring); //} for(%i = 2; %i >= 0; %i--) { %obj.setWheelTire(%i,Example1TireFront); %obj.setWheelSpring(%i,Example1SpringFront); } for(%i = 3; %i >= 2; %i--) { %obj.setWheelTire(%i,Example1TireRear); %obj.setWheelSpring(%i,Example1SpringRear); } } function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%speed) { // Collision with other objects, including items }