API Question Non-thruster related particle effects (explosions and the like)

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,868
Reaction score
4
Points
0
Location
San Diego
I'm already familiar with using dummy-thrusters + exhaust streams to model venting, contrails, and the like but could someone explain how I would go about modeling more transitory effects such as a fireball from a crash or catastrophic failure, the burst of debris from staging, or the shock cloud as a something approaches the sound barrier?

On a related note: Is there a more efficient way to move an exhaust stream than deleting and reforming it in the new position? A "SetExhaustPos ()" or similar?
 
I think both effects can be made with more creative application of dummy thrusters. A transient explosion effect is the same as any particle effect, but with shorter duration. It isn't particles, only ordinary exhaust, but I did a (fanciful) nuclear explosion this way:
[ame="http://www.youtube.com/watch?v=h1y-8LPPHNo"]Orbiter Torpedo Test - YouTube[/ame]

Expanding and rotating particles with appropriate texture could make for a fairly believable explosion. This was done in the [ame="http://orbithangar.com/searchid.php?ID=3439"]HARP[/ame] addon.

Thrusters can also have their position/direction changed dynamically, taking their particle streams with them.

Sorry if this isn't helpful, as you probably have a reason for avoiding dummy thrusters. If I may ask - what is wrong with them?
 
Proper texture on particles can produce nice effect.

exp02.jpg


ETSExplosion1.jpg
 
Well yes, obviously, but how do you code that?

That's few particle emmiters with tuned properties, custom textures and limited working time. Not sure if sourcecode for that still exists.
 
That effect was implemented through just a thruster and an exhaust stream, e.g.:
Code:
void clbkSetClassCaps(){
// Other vessel definition code \\
FXFuel = CreatePropellantResource(1);
fx_explosion[0] = CreateThruster(_V(0, 0, 0), _V(1, 0, 0), 1, FXFuel, 15);
AddExhaustStream(fx_explosion[0], _V(0, 0, 0), &explosion_fire);
SetThrusterLevel(fx_explosion[0], 1);
}
I managed to lose the particle effect (:facepalm:) so I can't help you there :(

It could also be implemented through a particle stream pretty easily, which might give you more control over the effect:
Code:
void clbkSetClassCaps(){
// Other vessel definition code \\
AddParticleStream(&explosion_fire,_V(0,0,0),_V(1,0,0),&explosionLevel);
}
 
Last edited:
Code used for Boom vessel in Jarvis dll explosion:

Code:
SURFHANDLE explosion = oapiRegisterExhaustTexture ("Jarvis\\explosion"); 
static PARTICLESTREAMSPEC def = {

	0,		// flag
	2,	// size
	0.5,		// rate
	5,	    // velocity
	0.5,    // velocity distribution
	10,		// lifetime
	30,	// growthrate
	0,    // atmslowdown 
	PARTICLESTREAMSPEC::EMISSIVE,
	PARTICLESTREAMSPEC::LVL_LIN, 0, 1.0,
	PARTICLESTREAMSPEC::ATM_FLAT, 1, 1,
	explosion
};


 ph_h[0]=CreatePropellantResource(1);
 th_h[0]=CreateThruster(_V(0,0,0),_V(0,0,1),1,ph_h[0],3,0,101400);



 AddExhaustStream(th_h[0],&def);

hope it helps!
 
Thrusters can also have their position/direction changed dynamically, taking their particle streams with them.

Err no, they can't.

I've tried that and if you move the thruster after the exhaust stream has been declared the thruster moves but the exhaust stream stays put.

See below...
picture.php


Post "ShiftCG" The thrusters' positions have been updated but their exhaust streams (circled in red) remain at their original coordinates.

This is why I was asking if there was an efficient way to update the position of a existing particle emitter.
 
ShiftCG has many issues unfortunately... everything must be done carefully when using it or a lot of things won't work. To avoid problems most of the time the most safe way is to clear all thrusters and redefine them from scratch
 
ShiftCG has many issues unfortunately... everything must be done carefully when using it or a lot of things won't work. To avoid problems most of the time the most safe way is to clear all thrusters and redefine them from scratch

I've tried avoiding ShiftCG but "SetThrusterRef ()" has the same issue. So far the only way I've found to update an exhaust stream's position is to delete it and then re-add it.

hence my question.
 
I just accidentally walked into this, don't know if it may help, from oapi docs:

void oapi:: ParticleStream::SetVariablePos ( const VECTOR3 * ppos )

Reset the particle source point reference.


Parameters:
ppos pointer to particle source point

Note:
This method overrides the previous position reference and any constant position value.

void oapi:: ParticleStream::SetVariableDir ( const VECTOR3 * pdir )

Reset the particle source direction reference.


Parameters:
pdir pointer to particle source direction

Note:
This method overrides the previous direction reference and any constant direction value
 
Ah, my mistake, then. Sorry. :(

Don't sweat it, it's a known bug. The docs say it should work but when you actually go to do it...

I just accidentally walked into this, don't know if it may help, from oapi docs:

That looks promising, but how would I point it to a specific stream? I see no input for a particle stream handle or interface.
 
That looks promising, but how would I point it to a specific stream? I see no input for a particle stream handle or interface.

hmmm let's see...

I'm not a c++ expert, I learnt only part of it for orbiter purpose... but I see that particlestream is a class, and from what I saw with sketchpad there could be the option to declare it as a class, like:
Code:
oapi::ParticleStream *ps

and then in your code use something like:
Code:
ps->Attach(...)
ps->SetVariablePos(...)

or something?

I repeat, I'm not an expert...
 
hmmm let's see...

I'm not a c++ expert, I learnt only part of it for orbiter purpose... but I see that particlestream is a class, and from what I saw with sketchpad there could be the option to declare it as a class, like:
Code:
oapi::ParticleStream *ps

In that case how do I to get a pointer to the graphics client instance so I can call the particle stream's constructor?
 
In that case how do I to get a pointer to the graphics client instance so I can call the particle stream's constructor?

This is Houston, say again please? :lol:
 
Back
Top