SDK Question Advice for Creating EXHAUSTSPEC Without Thrusters

Mr Martian

Orbinaut/Addon dev/Donator
Addon Developer
Donator
Joined
Jun 6, 2012
Messages
275
Reaction score
62
Points
28
Location
Sydney, Australia, Earth, Sol
Website
www.orbithangar.com
Hi All,

I am trying to create an exhaust whose level is not defined by a thruster handle, but is instead based on my own custom level. I have run into difficulties and I am not sure if this is something that Orbiter's SDK does not support, or if anyone else has found a workaround for this.

Below I have posted code for what I am trying to achieve, this may make more sense than my description:

C++:
    VECTOR3 pos1 = _V(0,0,1);
    VECTOR3 pos2 = _V(0,0,-1);
    EXHAUSTSPEC es_mg[2] = {
        {NULL, &lvl, &pos1, &pos1, 6, 1.4, 0, 0.3, NULL},
        {NULL, &lvl, &pos2, &pos2, 6, 1.4, 0, 0.3, NULL}
    };
    int i;
    for (i = 0; i < 2; i++) AddExhaust (es_mg+i);

I have used EXHAUSTSPEC here as I really do need this exhaust to have the random intensity variations (flickering effect).

lvl is a double which is updated in clbkPreStep.

This compiles correctly and orbiter launches, however the exhaust appears distorted, not always visible, and the positions seem to all be x,y,z 0,0,0.

has anyone else ever tried to add an exhaust that is not based on an engine? one that utilises EXHAUSTSPEC's flickering effect?

Any help would be much appreciated.

Thanks in advance,

MrMartian
 
Last edited:

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,010
Reaction score
1,644
Points
188
Website
github.com
From the SDK:
If spec->th == NULL (thruster-independent exhaust definition), then spec->level, spec->lpos and spec->ldir must not be NULL. They must point to variables that continuously define the level, position and negative direction of the exhaust cone. The variables themselves must persist during the lifetime of the exhaust definition.
An exeption is the definition of a constant parameter. For example, if the exhaust position is to be set to a fixed position, set the spec->flags field to EXHAUST_CONSTANTPOS.


So you need pos1 and pos2 to be defined inside the class, and also add dir1 and dir2, as having the same variable for position and direction might not work in this case.
 
Top