Game Development Community

Jet Nozzle

by Aidan Sliney · in Torque Game Engine · 09/27/2007 (2:32 am) · 21 replies

Hi there
I just read a couple of threads on the subject, but i still can't find how to mount particle emitters on a flying vehicle and have them actually emitting particles !
I added dummies on my vehicle model (JetNozzle0, JetNozzle1), parented them to Detail32, exported the whole thing but then I can't seem to see any trace of the particle emitters ...
I have a particle emitter that works when it isn't mounted, so i guess that its datablock is correctly set.

I believe that my emitters are just not activated ... How exactly do I activate them ?
I tried to bind a key to the mouseJet function, but with no success ...
(i don't know if it makes a difference, but the player object isn't mounted on the vehicle, i am controlling the vehicle alone.)

Do anyone know a way for me to finally have my particle emitters showing up ??

Thanks in advance !
Page «Previous 1 2
#1
09/27/2007 (2:33 am)
- Check that the nodes are actually exporting (use Show Tool).

- You will need a jetting function (I think) make sure yours is working correctly.
#2
09/27/2007 (3:24 am)
I just checked, the nodes were exported.
As for the jetting function, for the moment i have a key bound to the mousejet function :

function mousejet(){
echo("jet");
$mvTriggerCount3++;
}

i can call the function, it will echo "jet", but it won't do anything else, i mean my vehicle doesn't seem to jet.
I have several vehicles, but only one at a time is controlable. And the player object isn't mounted.
#3
09/27/2007 (3:29 am)
Have you added all the required information to your flying vehicle datablock?

E.g.
minTrailSpeed     = 15; // The speed your contrail shows up at.
   trailEmitter      = ContrailEmitter; // Your emitter datablocks
   forwardJetEmitter = FlyerJetEmitter;
   downJetEmitter    = FlyerJetEmitter;
#4
09/27/2007 (3:32 am)
Yes, and I am using the same emitter for the 3 parameters.
#5
09/27/2007 (3:34 am)
Here's some example datablocks, you'll need to use your own textures and alter the paths accordingly:
//--------------------------------------------------------------
// FLIER CONTRAILS
//--------------------------------------------------------------

datablock ParticleData(ContrailParticle)
{
   dragCoefficient      = 1.5;
   gravityCoefficient   = 0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 3000;
   lifetimeVarianceMS   = 0;
   textureName          = "particleTest";
   colors[0]            = "0.6 0.6 0.6 0.5";
   colors[1]            = "0.2 0.2 0.2 0";
   sizes[0]             = 0.6;
   sizes[1]             = 5;
};

datablock ParticleEmitterData(ContrailEmitter)
{
   ejectionPeriodMS = 5;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 10;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   particles        = "ContrailParticle";
};


datablock ParticleData(FlyerJetParticle)
{
   dragCoefficient      = 1.5;
   gravityCoefficient   = 0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 200;
   lifetimeVarianceMS   = 0;
   textureName          = "particleTest";
   colors[0]            = "0.9 0.7 0.3 0.6";
   colors[1]            = "0.3 0.3 0.5 0";
   sizes[0]             = 2;
   sizes[1]             = 6;
};

datablock ParticleEmitterData(FlyerJetEmitter)
{
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 20;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 10;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   particles        = "FlyerJetParticle";
};

For jetting, you'll need something like this in the datablock:
maxEnergy         = 280; // Afterburner and any energy weapon pool
   rechargeRate      = 0.8;
#6
09/27/2007 (3:42 am)
Oh, name your nodes Contrail0, Contrail1 etc if you're after the wisps from the wings. JetNozzle0, JetNozzle1 are for thrusting and are usually placed on the exhaust of the engine.
#7
09/27/2007 (3:44 am)
Still nothing ... the mouseJet function is called, but the vehicle won't budge neither will the emitters show up ....

EDIT : I tried to re-export with 4 nodes (JetNozzle0,JetNozzle1, Contrail0, Contrail1) ... still nothing. I do perhaps miss a mount0 node or something ?
#8
09/27/2007 (3:50 am)
Whilst jetting the JetNozzle nodes should come into action. The contralis should be on always (pending on the speed setting in your datablock).

I don't know why it's not working for you?
#9
09/27/2007 (4:06 am)
May it be in relation to the fact that I set 3 vehicle datablocks (one of them with the jet emitters set), I then create a vehicle for each datablock and have then to manually take the control of the wanted vehicle ?
Maybe I should first try to create only one vehicle ... I'm a bit confused I must say !
#10
09/27/2007 (4:06 am)
@Aidan: Might want to have a look at the Flight Game Example? It covers a complete flying game solution incl. source art and scripts.
#11
09/27/2007 (4:18 am)
@Martin : as you may have noticed, "Sylvain" (blender forum) & "Aidan" are only one person (i'm a student working on a TGE version purchased by my university) !
I already saw the demo videos a few days ago, looks very cool ! However, i'm just a starving student, so i'm not going to puchase the game (yet !) :)
#12
09/27/2007 (4:29 am)
Hehe, no, didn't notice that this was just one person! :-) But anyway, glad you liked the videos. :-)
#13
09/27/2007 (5:26 am)
You say the ship wont budge... meaning it wont move? If so, that means your script file might have errors. Check your console (Press Tilde "~").

Another thing you might wanna chech is your scale. If it's too big you wont see the particles.
#14
09/27/2007 (5:43 am)
Contails work ! Had to set the minTrailSpeed to a lower value ........ !

@James : if I press the directionnal keys, the vehicle moves (and now the contrails emitters show up !). It's only the jetting that doesn't seem to work. When I press the appropriate key, the 'echo("Jetting")' appears, but there will be no reaction from the vehicle. => No jetting => no exhausts (I guess)

The way I'm using the vehicle is not a flight simulation or anything. My vehicle is a surgical tool that can be used to burn some tissues. (I've chosen to use a FlyingVehicle because it allows me to have the tool rotating around a fixed point and actually colliding with other elements whilst rotating).

So I would need to have the emitter triggered by a key. But i don't want this key to make the vehicle move !

I checked in the console, no error.
#15
09/27/2007 (8:20 am)
Check in your code (C++) if the jetting is actually getting triggered. You can see there too if your ParticleEmitter is updated.

Things to check:
- Did you change anything in the code? I know I moved my Jetting trigger to the 5th Tigger, from 3rd.
- Make sure you have a value for jetEnergyDrain that is low enough that it would actually activate the particleEmitter long when activated.
- Also make sure your is maxEnergy higher than your minJetEnergy in your FlyingVehicleDatablock.


There was a bug in that had the up/down Jettriggers a little buggered, not sure if it has been fixed.
Check for the JetNozzleX and see if it's duplicated in the Nodes(I'm trying to remember this, dont have code with me).

Post your FlyingVehicle Datablock.

Also check here if you havent for an example.

EDIT: Got the maxEnergy and minJetEnergy Swapped around
#16
09/27/2007 (8:41 am)
Here's my datablock :

datablock FlyingVehicleData(DroneData0)
{
	spawnOffset						= "0 0 2";
	emap							= true;
	category						= "Vehicles";
	shapeFile						= "./jet_test2.dts";
	multipassenger					= false;
	computeCRC						= true;
	
	
	//debrisShapeName					= "~/data/shapes/vehicles/Drone/flyer.dts";
	//debris							= DroneShapeDebris;
	//renderWhenDestroyed				= false;

	drag							= 0.15;
	density							= 3.0;

	mountPose[0]					= sitting;
	numMountPoints					= 1;
	isProtectedMountPoint[0]		= true;
	cameraMaxDist					= 0.5;
	cameraOffset					= 4.5;
	cameraLag						= 0.0;
    cameraRoll = true;         // Roll the camera with the vehicle



    // explosion						= DroneVehicleExplosion;
	explosionDamage					= 10.5;
	explosionRadius					= 15.0;

	maxDamage						= 50.40;
	destroyedLevel					= 50.40;
									
	isShielded						= true; 
	energyPerDamagePoint			= 160;
	maxEnergy						= 280;      // Afterburner and any energy weapon pool
	rechargeRate					= 0.8;

	minDrag							= 30;           // Linear Drag (eventually slows you down when not thrusting...constant drag)
	rotationalDrag					= 10;        // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)

	maxAutoSpeed					= 100;       // Autostabilizer kicks in when less than this speed. (meters/second)
	autoAngularForce				= 200;       // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
	autoLinearForce					= 200;        // Linear stabilzer force (this slows you down when autostabilizer kicks in)
	autoInputDamping				= 0.95;      // Dampen control input so you don't' whack out at very slow speeds
    integration = 6;           // Physics integration: TickSec/Rate
    collisionTol = 0.2;        // Collision distance tolerance
    contactTol = 0.1;
   
	// Maneuvering
	maxSteeringAngle				= .1;    // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
	horizontalSurfaceForce			= 6;   // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
	verticalSurfaceForce			= 4;     // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
	maneuveringForce				= 2400;      // Horizontal jets (W,S,D,A key thrust)
	steeringForce					= 150;         // Steering jets (force applied when you move the mouse)
	steeringRollForce				= 0;      // Steering jets (how much you heel over when you turn)
	rollForce						= 80;  // Auto-roll (self-correction to right you after you roll/invert)
	hoverHeight						= 25;       // Height off the ground at rest
	createHoverHeight				= 25;  // Height off the ground when created
	maxForwardSpeed					= 60;  // speed in which forward thrust force is no longer applied (meters/second)
	SteeringSpeed					= 1;

	// 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							= 30;        // Mass of the vehicle
	bodyFriction					= 0;     // Don't mess with this.
	bodyRestitution					= 0.1;   // 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;

	//
	minTrailSpeed					= 0.1;      // The speed your contrail shows up at.
	trailEmitter					= ContrailEmitter;
	forwardJetEmitter				= FlyerJetEmitter;
	downJetEmitter					= FlyerJetEmitter;

	//
	//jetSound						= DroneThrustSound;
	//engineSound						= DroneEngineSound;
	//softImpactSound					= DroneSoftImpactSound;
	//hardImpactSound					= DroneHardImpactSound;
	//
	//softSplashSoundVelocity			= 10.0;
	//mediumSplashSoundVelocity		= 15.0;
	//hardSplashSoundVelocity			= 20.0;
	//exitSplashSoundVelocity			= 10.0;

	//exitingWater					= DroneExitWaterMediumSound;
	//impactWaterEasy					= DroneImpactWaterSoftSound;
	//impactWaterMedium				= DroneImpactWaterMediumSound;
	//impactWaterHard					= DroneImpactWaterMediumSound;
	//waterWakeSound					= DroneWakeMediumSplashSound;

//	dustEmitter						= VehicleLiftoffDustEmitter;
	
	triggerDustHeight				= 4.0;
	dustHeight						= 1.0;

//	damageEmitter[0]				= DroneJetEmitter;

//	damageEmitter[1]				= DroneJetEmitter;
//
//	damageEmitter[2]				= DroneJetEmitter;

	damageEmitterOffset[0]			= "0.0 -3.0 0.0 ";
	damageLevelTolerance[0]			= 0.3;
	damageLevelTolerance[1]			= 0.7;
	numDmgEmitterAreas				= 3;
						
	//
	//max[RocketAmmo]					= 1000;

	minMountDist					= 2;

	//splashEmitter[0]				= VehicleFoamDropletsEmitter;
	//splashEmitter[1]				= VehicleFoamEmitter;

	//shieldImpact					= VehicleShieldImpact;

	//cmdCategory						= "Tactical";
	//cmdIcon							= CMDFlyingScoutIcon;
	//cmdMiniIconName					= "commander/MiniIcons/com_scout_grey";
	//targetNameTag					= 'Drone';
	//targetTypeTag					= 'FlyingVehicle';
	//sensorData						= AWACPulseSensor;
	//sensorRadius					= AWACPulseSensor.detectRadius;
	//sensorColor						= "255 194 9";
									
	checkRadius						= 5.5;
	observeParameters				= "0 0 0";
									
	shieldEffectScale				= "0.937 1.125 0.60";
	
	
	//massCenter="0 -10 0";
	disableCollision = false;
};


I have changed a couple of things in the code :

i commented out these lines in flyingvehicle.cc :

//MODIF : prevents vehicle from going back to its original position when i drop the commands
   
   //if (speed < mDataBlock->maxAutoSpeed)
    //  mSteering *= mDataBlock->autoInputDamping;

   //MODIF


and i modified the steering part in vehicle.cc, accordingly to a ressource on the site :

// Steering
   //if (move != &NullMove) {
   //   F32 y = move->yaw;
   //   mSteering.x = mClampF(mSteering.x + y,-mDataBlock->maxSteeringAngle,
   //                         mDataBlock->maxSteeringAngle);
   //MODIF
   
   if (move != &NullMove) {
      F32 y = move->yaw;
      if(y>M_PI) y-=M_2PI;
      //mSteering.x = mClampF((y*mDataBlock->SteeringSpeed), -mDataBlock->maxSteeringAngle, mDataBlock->maxSteeringAngle);
      mSteering.x = (y*mDataBlock->SteeringSpeed);

   //MODIF

I tried a whole bunch of values for minJetEnergy, maxEnergy and JetEnergyDrain .. but with no success ...
#17
09/27/2007 (9:19 am)
Have you declared these two lines in your onAdd method?
%obj.setRechargeRate(%this.rechargeRate);
   %obj.setEnergyLevel(%this.MaxEnergy);
#18
09/27/2007 (9:56 am)
Just did, but it doesn't make a difference.
I was wondering if I could mount a particle emitter on a 'mount#' node instead ?
I have defined a ParticleEmitterNode which i tried to mount using 'mountObject' (and also mountImage, just in case) ... apparently particleemitternode isn't derived from the right class to allow the mounting on a vehicle, right ?
#19
09/28/2007 (6:20 am)
Yes you can mount a Particle to a node. Just do a search.
When you use your Jets/afterburner, do you notice it going faster?

Another thing... Remember that your ParticleEmitters and stuff should be declared BEFORE your FlyingVehicleData(DroneData0) datablock.

Not sure where you did it, but you can have an exec command at the top of the Drone script, or in you game.cs make sure you exec the script file with your Particles before you exec the Drone script.
#20
09/28/2007 (6:27 am)
Quote:Yes you can mount a Particle to a node. Just do a search.

must have missed it then, going to look again !

Quote:When you use your Jets/afterburner, do you notice it going faster?

No, i haven't noticed anything ...

Quote:Another thing... Remember that your ParticleEmitters and stuff should be declared BEFORE your FlyingVehicleData(DroneData0) datablock.

Not sure where you did it, but you can have an exec command at the top of the Drone script, or in you game.cs make sure you exec the script file with your Particles before you exec the Drone script.

I had my emitter declared in the same file as the flying vehicle datablock, at the top of the file actually.
Page «Previous 1 2