Author Topic: Dragracer Vehicle Emitters  (Read 1157 times)

I am currently working on The Exhaust emitters for my Dragracer. How do I get this to wotk for more than one joint? If only works on one of my exhaust pipes.
Code: [Select]
datablock ParticleData(DragTireParticle)
{
   dragCoefficient      = 10;
   gravityCoefficient   = -0.15;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 1250;
   lifetimeVarianceMS   = 150;
   textureName          = "base/data/particles/cloud";

spinSpeed = 50.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;

   colors[0]     = "5.0 5.0 5.0 0.2";
   colors[1]     = "5.0 5.0 5.0 0.0";
   sizes[0]      = 0.2;
   sizes[1]      = 3.9;

   useInvAlpha = true;
};

datablock ParticleEmitterData(DragTireEmitter)
{
   ejectionPeriodMS = 6;
   periodVarianceMS = 0;
   ejectionVelocity = 10;
   velocityVariance = 5.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 95;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = DragTireParticle;

   uiname = "Dragracer Tire Emitter";
};

datablock WheeledVehicleTire(DragBigTire)
{
   shapeFile = "./DragBigTire.dts";

mass = 10;
    radius = 1;
    staticFriction = 5;
   kineticFriction = 5;
   restitution = 0.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 4000;
   lateralRelaxation = 0.01;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 14000;
   longitudinalDamping = 2000;
   longitudinalRelaxation = 0.01;
};
datablock WheeledVehicleTire(DragSmallTire)
{
   shapeFile = "./DragSmallTire.dts";

mass = 10;
    radius = 1;
    staticFriction = 5;
   kineticFriction = 5;
   restitution = 0.5;

   // Spring that generates lateral tire forces
   lateralForce = 20000;
   lateralDamping = 6000;
   lateralRelaxation = 0.01;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 18000;
   longitudinalDamping = 4000;
   longitudinalRelaxation = 0.01;
};

datablock WheeledVehicleSpring(DragSmallSpring)
{
   // Wheel suspension properties
   length = 0.4; // Suspension travel
   force = 2500; //2000; // Spring force
   damping = 1500; //1500; // Spring damping
   antiSwayForce = 1; //1; // Lateral anti-sway force
};

datablock WheeledVehicleSpring(DragBigSpring)
{
   // Wheel suspension properties
   length = 0.4; // Suspension travel
   force = 1700; //1550; // Spring force
   damping = 1000; //1000; // Spring damping
   antiSwayForce = 1; //1; // Lateral anti-sway force
};

// Sounds //
////////////
datablock AudioProfile(fastImpactSound)
{
   filename    = "./fastimpact.WAV";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(slowImpactSound)
{
   filename    = "./slowimpact.wav";
   description = AudioDefault3d;
   preload = true;
};


// Vehicle //
/////////////
datablock WheeledVehicleData(DragracerVehicle)
{
category = "Vehicles";
displayName = " ";
shapeFile = "./dragracer.dts";
emap = true;
minMountDist = 3;
   
   numMountPoints = 1;
   mountThread[0] = "sit";

maxDamage = 200.00;
destroyedLevel = 200.00;
speedDamageScale = 1.04;
collDamageThresholdVel = 20.0;
collDamageMultiplier   = 0.02;

massCenter = "0 0 0";
   //massBox = "2 5 1";

maxSteeringAngle = 0.6;  // Maximum steering angle, should match animation
integration = 4;           // Force integration time: TickSec/Rate
tireEmitter = DragTireEmitter; // All the tires use the same dust emitter

// 3rd person camera settings
cameraRoll = false;         // Roll the camera with the vehicle
cameraMaxDist = 13;         // Far distance from vehicle
cameraOffset = 7.5;        // Vertical offset from camera mount point
cameraLag = 0.0;           // Velocity lag of camera
cameraDecay = 0.75;        // Decay per sec. rate of velocity lag
cameraTilt = 0.4;
   collisionTol = 0.1;        // Collision distance tolerance
   contactTol = 0.1;

useEyePoint = false;

defaultTire = DragSmallTire;
defaultSpring = DragBigSpring;
flatTire = jeepflattire;
flatSpring = jeepflatspring;

   numWheels = 4;

// Rigid Body
mass = 300;
density = 5.0;
drag = 3.0;
bodyFriction = 0.6;
bodyRestitution = 0.6;
minImpactSpeed = 10;        // Impacts over this invoke the script callback
softImpactSpeed = 10;       // Play SoftImpact Sound
hardImpactSpeed = 15;      // Play HardImpact Sound
groundImpactMinSpeed    = 10.0;

// Engine
engineTorque = 9000;
engineBrake = 2000;
brakeTorque = 8000;
maxWheelSpeed = 90;

rollForce = 300;
yawForce = 300;
pitchForce = 300;
rotationalDrag = 0.05;

   // Advanced Steering
   steeringAutoReturn = true;
   steeringAutoReturnRate = 3.0;
   steeringAutoReturnMaxSpeed = 4;
   steeringUseStrafeSteering = true;
   steeringStrafeSteeringRate = 0.1;

// Energy
maxEnergy = 100;
jetForce = 3000;
minJetEnergy = 30;
jetEnergyDrain = 2;



// Sounds
softImpactSound = slowImpactSound;
hardImpactSound = fastImpactSound;
//wheelImpactSound = slowImpactSound;

//   explosion = VehicleExplosion;
justcollided = 0;

   uiName = "Dragracer";
rideable = true;
lookUpLimit = 0.65;
lookDownLimit = 0.45;

paintable = true;
   
   damageEmitter[0] = VehicleBurnEmitter;
damageEmitterOffset[0] = "0.0 0.0 0.0 ";
damageLevelTolerance[0] = 0.99;

   damageEmitter[1] = VehicleBurnEmitter;
damageEmitterOffset[1] = "0.0 0.0 0.0 ";
damageLevelTolerance[1] = 1.0;

   numDmgEmitterAreas = 1;

   initialExplosionProjectile = DragracerExplosionProjectile;
   initialExplosionOffset = 0;         //offset only uses a z value for now

   burnTime = 4000;

   finalExplosionProjectile = DragracerFinalExplosionProjectile;
   finalExplosionOffset = 0.5;          //offset only uses a z value for now

   minRunOverSpeed    = 20;   //how fast you need to be going to run someone over (do damage)
   runOverDamageScale = 30;   //when you run over someone, speed * runoverdamagescale = damage amt
   runOverPushScale   = 1000; //how hard a person you're running over gets pushed
};

function DragracerVehicle::onAdd(%this,%obj)
{
parent::onadd(%this,%obj);
%obj.mountable = true;

%obj.setWheelTire(0, DragSmallTire);
%obj.setWheelTire(1, DragSmallTire);
%obj.setWheelTire(2, DragBigTire);
%obj.setWheelTire(3, DragBigTire);

%obj.setWheelSpring(0, DragSmallSpring);
%obj.setWheelSpring(1, DragSmallSpring);
%obj.setWheelSpring(2, DragBigSpring);
%obj.setWheelSpring(3, DragBigSpring);

%obj.setWheelSteering(0,1);
%obj.setWheelSteering(1,1);
%obj.setWheelSteering(2,0);
%obj.setWheelSteering(3,0);

%obj.setWheelPowered(0,true);
    %obj.setWheelPowered(1,true);
%obj.setWheelPowered(2,true);
%obj.setWheelPowered(3,true);

   %obj.playthread(0,"propslow");

DragracerSmokeCheck(%obj);

}

datablock ParticleData(DragExhaustParticle)
{
   textureName          = "base/data/particles/cloud";
   dragCoefficient      = 0.0;
   windCoefficient      = 0.5;
   gravityCoefficient   = -0.5;
   inheritedVelFactor   = 0.2;
   lifetimeMS           = 300;
   lifetimeVarianceMS   = 0;
   useInvAlpha = true;
   spinRandomMin = 0.0;
   spinRandomMax = 0.0;

   colors[0]     = "0.7 0.5 0.2 0.7";
   colors[1]     = "0.7 0.7 0.7 0.07";
   colors[2]     = "0.75 0.75 0.75 0.0";

   sizes[0]      = 0.20;
   sizes[1]      = 0.25;
   sizes[2]      = 3;

   times[0]      = 0;
   times[1]      = 0.1;
   times[2]      = 1;
};

datablock ParticleEmitterData(DragExhaustEmitter)
{
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 0.5;
   velocityVariance = 0.0;
   ejectionOffset   = 0.1;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "DragExhaustParticle";
};

datablock ShapeBaseImageData(DragExhaustImage1)
{
   shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = 6;
   rotation = "1 0 0 -90";

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateEmitter[1] = DragExhaustEmitter;
stateEmitterTime[1] = 10000;

};

function DragracerSmokeCheck(%obj)
{
  %obj.mountImage(DragExhaustImage1,2);


}


« Last Edit: October 02, 2010, 07:30:04 AM by Uxie »

Wrong section goes in coding help.

Wrong section goes in coding help.

No, this is General Modification Help.
This is in the right topic.

Finally got some replies. I've been stuck trying to do this for a while.

I also tried ejectPoint0
If you have used that joint you need to add that to the emitter in the script.

Isn't it obvious that I did?

Isn't it obvious that I did?
Oh so that snippet of code wasen't the entire emitter code?

Well Isn't that what I am asking?

Well Isn't that what I am asking?
Ill take a look at another vehicles emitters for you to check.
EDIT: I looked on the turismo model and the Mount 3 and Mount 4 Joints are used for the smoke emitter.

Code: [Select]
datablock ParticleData(VehicleNameExhaustParticle)
{
   textureName          = "base/data/particles/cloud";
   dragCoefficient      = 0.0;
   windCoefficient      = 0.5;
   gravityCoefficient   = -0.5;
   inheritedVelFactor   = 0.2;
   lifetimeMS           = 300;
   lifetimeVarianceMS   = 0;
   useInvAlpha = true;
   spinRandomMin = 0.0;
   spinRandomMax = 0.0;

   colors[0]     = "0.7 0.5 0.2 0.7";
   colors[1]     = "0.7 0.7 0.7 0.07";
   colors[2]     = "0.75 0.75 0.75 0.0";

   sizes[0]      = 0.20;
   sizes[1]      = 0.25;
   sizes[2]      = 3;

   times[0]      = 0;
   times[1]      = 0.1;
   times[2]      = 1;
};

datablock ParticleEmitterData(VehicleNameExhaustEmitter)
{
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 0.5;
   velocityVariance = 0.0;
   ejectionOffset   = 0.1;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "VehicleNameExhaustParticle";
};

datablock ParticleData(VehicleNameExhaustTireParticle)
{
   dragCoefficient      = 3;
   windCoefficient     = 0;
   gravityCoefficient   = 1;
   inheritedVelFactor   = 0.0;
   constantAcceleration = 0.0;
   spinRandomMin = -90;
   spinRandomMax = 90;
   lifetimeMS           = 900;
   lifetimeVarianceMS   = 0;
   textureName          = "base/data/particles/chunk";
   colors[0]     = "0.1 0.1 0.1 1";
   colors[1]     = "0.1 0.1 0.1 0";
   sizes[0]      = 0.4;
   sizes[1]      = 0.05;
};

datablock ParticleEmitterData(VehicleNameExhaustTireEmitter)
{
   ejectionPeriodMS = 2;
   periodVarianceMS = 0;
   ejectionVelocity = 0.5;
   velocityVariance = 0.0;
   ejectionOffset   = 0.1;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "VehicleNameExhaustTireParticle";
};

datablock ShapeBaseImageData(VehicleNameExhaustImage1)
{
   shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = 3;
   rotation = "1 0 0 -90";

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateEmitter[1] = VehicleNameExhaustEmitter;
stateEmitterTime[1] = 10000;

};

function VehicleNameSmokeCheck(%obj)
{
  %obj.mountImage(VehicleNameExhaustImage1,2);


}
That's for One Exaust on mount point 3, You can change the number if you don't like that mount point. Also just replace VehicleName with your vehicles name.

Thanks Phydoux for most of the script :)
« Last Edit: September 23, 2010, 06:37:38 PM by alex dude »

I didn't notoce that in the script... Well I used the one from the Arwing. I'll use this one though. The one with the arwing would only use one of my 6 emitters. How to I change the amount of emitters used?

Modified To a better question.
Hope someone can help.