General Question moving exhuaust streams

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
I have added a exhaust stream to the tower. No problem. But because this exhaust stream needs to match the animation that is a problem.

I added an attachment to see if the values of the location changed and they do. But the exhaust remain at the starting point.

towersmoke_zps8rnqrgcl.jpg


Code:
vapourlocation[0] = _V(-16.88219, 6.607, -3.882331);
		vapourlocation[1] = _V(-16.88219, 5.607, -3.882331);
		vapourlocation[2] = _V(-16.88219, 6.607, -4.882331);




Code:
void SLSTOWER::clbkSetClassCaps(FILEHANDLE cfg)

{
...
//smoke
	PROPELLANT_HANDLE ph_vernier = CreatePropellantResource(FUELMASS);

	// lox vent
	PARTICLESTREAMSPEC contrail_vapour = {
		0, 0.4, 30, 0.5, 10, 1.5, 0.8, 4.0, PARTICLESTREAMSPEC::EMISSIVE,
		PARTICLESTREAMSPEC::LVL_PSQRT, 0, 1,
		PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
	};
	//// LOX vent streams
	th_vapour = CreateThruster(_V(0, 0, 0), _V(1, 0, 0), PB_MAXHOVERTH, ph_vernier, PB_ISP);
	AddExhaustStream(th_vapour, _V(-16.88219, 6.607, - 3.882331), &contrail_vapour);
	//AddExhaustStream(th_vapour, _V(1.029, 0.47, 39.82), &contrail_vapour);
	// big launch smoke
	PARTICLESTREAMSPEC contrail_steam = {
		0, 32, 20, 250, 1.2, 4, 12, 3.0, PARTICLESTREAMSPEC::EMISSIVE,
		PARTICLESTREAMSPEC::LVL_PSQRT, 0, 1,
		PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
	};

	// small launch smoke
	PARTICLESTREAMSPEC contrail_steam2 = {
		0, 10, 10, 40, 2, 3, 6, 5.0, PARTICLESTREAMSPEC::EMISSIVE,
		PARTICLESTREAMSPEC::LVL_PSQRT, 0, 1,
		PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
	};
	/// big flame duct smoke
	th_steam[0] = CreateThruster(_V(-38.5, -9.7, 0), _V(0.866, 0.1, -0.5), PB_MAXHOVERTH, ph_vernier, PB_ISP);
	AddExhaustStream(th_steam[0], &contrail_steam);

	/// small pad smoke
	th_steam[1] = CreateThruster(_V(0, 0, 4), _V(0, 0, -1), PB_MAXHOVERTH, ph_vernier, PB_ISP);
	AddExhaustStream(th_steam[1], &contrail_steam2);
}
This just turns the exhaust on if a vessel is near and thruster off
Code:
void SLSTOWER::clbkPreStep(double SimT, double SimDT, double MJD) {

	ENGINESTATUS es;
	VECTOR3 gpos, gpad;

	/// global pos of point just above pad
	Local2Global(_V(0, 20, 0), gpad);

	for (DWORD i = 0; i < oapiGetVesselCount(); i++) // check each vessel in turn
	{
		OBJHANDLE hV = oapiGetVesselByIndex(i);

		if (hV == GetHandle()) continue; // we don't want to check ourselves ...
		oapiGetGlobalPos(hV, &gpos);

		if (dist(gpos, gpad) < 150) // if vessel in range, get engine status
		{
			VESSEL *v = oapiGetVesselInterface(hV);
			oapiGetEngineStatus(hV, &es);
			break;
		}
	}


	// if engine is on and umb. extended, retract umb. and stop LOX vent
	if (es.main > 0.7 )
	{
		
		SetThrusterLevel(th_vapour, 0);
	}

	else 
	
	{

		SetThrusterLevel(th_vapour, 1);
	}





	
}
sets the vaporlocation to match animation

Code:
	rms2_anim[0] = new MGROUP_ROTATE(0, CSFWDGrp, 4, _V(-4.186, 39.28096, -5.806), _V(0, 1, 0), (float)(180 * RAD)); // -2 .. +145
	rms2_anim[1] = new MGROUP_TRANSLATE(0, CSFWDGrp1, 1, _V(0, 50, 0));
	rms2_anim[2] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(vapourlocation), 3, _V(4.451, -7.793, 0), _V(0, 1, 0), (float)(894 * RAD));
	hAC_arm = AddAnimationComponent(anim_CSFWD2, 0, 1, rms2_anim[2], parent);
	anim_CSFWD = CreateAnimation(0.0);
	anim_CSFWDT = CreateAnimation(0.0);
	anim_CSFWD2 = CreateAnimation(0.0);
	parent = AddAnimationComponent(anim_CSFWD, 0, 1, rms2_anim[1]); //engine
	parent = AddAnimationComponent(anim_CSFWDT, 0, 1, rms2_anim[0], parent);
	parent = AddAnimationComponent(anim_CSFWD2, 0, 1, rms2_anim[2], parent);

Code:
void SLSTOWER::clbkPostStep(double simt, double simdt, double mjd)
{
	
	
		xp0 = vapourlocation[1] - vapourlocation[0]; normalise(xp0);
	xr0 = vapourlocation[2] - vapourlocation[0]; normalise(xr0);
	SetAttachmentParams(vapor1, vapourlocation[0], xp0, xr0);
	
	
	SetThrusterRef(th_vapour, vapourlocation[0]);
	AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);
	
	...}


---------- Post added at 11:04 AM ---------- Previous post was at 09:38 AM ----------

I got it to work. But it leaves multiple exhaust streams. So I may just have a key to turn on/off the exhaust.

---------- Post added at 01:22 PM ---------- Previous post was at 11:04 AM ----------

Added these line:
Code:
	if (vapouryes == 1)	AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);//turn on exhuaust
	if (vapouryes == 0)	DelExhaustStream(th_vapour);//turn off exhuast

but it make the exhuast stream I turn it off and move the arm but the first one is present.
 
Last edited:

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
1
Points
0
Location
San Diego
I think the simplest solution would be to have an actual thruster and then bind the partical stream to that.

You can then move the thruster using SetThrusterRef depending on the animation state and the exhaust stream should move with it. Just set the thruster's thrust to something like 0.01 newtons, I don't think the tower will move much ;)
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
Thanks. The problem is it isn't deleting the exhaust stream. that exists.

Right now. I press 1 that sets vapouryes=1 so show exhaust stream
when I press it again though and move the arm no exhaust stream but the one created is still going.


exhauststremissues_zpshlpu4ubb.jpg



Code:
if (key == OAPI_KEY_1)
	{
		if (vapouryes == 0)vapouryes = 1;
		else vapouryes = 0;
		DelExhaustStream(th_vapour);
		return 1;
	}

Code:
SetThrusterRef(th_vapour, vapourlocation[0]);
	
	
	if (vapouryes == 1)	AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);//turn on exhuaust
	if (vapouryes == 0)	DelExhaustStream(th_vapour);//turn off exhuast
 
Last edited:

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
1
Points
0
Location
San Diego
Why are you creating and deleting exhaust streams rather than just moving the one you already have?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
Why are you creating and deleting exhaust streams rather than just moving the one you already have?

Good question. Maybe not studying the API Reference first about the possibilities regarding particle streams.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
1
Points
0
Location
San Diego
Good question. Maybe not studying the API Reference first about the possibilities regarding particle streams.

See my comment above.

I've used particle streams in conjunction with gimbaled engines / animated TVC and I don't see why it wouldn't work here.

The only catch is that thruster actually has to produce thrust for the PStream to work. That said, but if you give the thruster a thrust of 0.1 newtons and the tower a realistic mass I don't think the tower will move much.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
See my comment above.

I've used particle streams in conjunction with gimbaled engines / animated TVC and I don't see why it wouldn't work here.

The only catch is that thruster actually has to produce thrust for the PStream to work. That said, but if you give the thruster a thrust of 0.1 newtons and the tower a realistic mass I don't think the tower will move much.

The tower CAN fall down, if the thruster is producing too much acceleration. But that transition is not that easily triggered by RCS.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
1
Points
0
Location
San Diego
The tower CAN fall down, if the thruster is producing too much acceleration. But that transition is not that easily triggered by RCS.

0.1 newtons vs a 27 kiloton launch platform. Thats an acceleration 0.0000037 meters per second^2, I think it'll be fine. ;)
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,314
Reaction score
599
Points
203
0.1 newtons vs a 27 kiloton launch platform. Thats an acceleration 0.0000037 meters per second^2, I think it'll be fine. ;)
Well, this talking directly from experience: Orbiter doesn't quite like weak steady state thrusters and being on the ground at the same time, even though the parent mass may be a million times more, especially during time acceleration. Best way is to attach the ML, making it an child of the six ML Mount Mechanisms. This way everything will stay in place even during high time acceleration factors.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
OK. The reason I delete is for some reason it thinks the thruster is at the old position and so more are made. here it is with no delete

h>
Code:
const double PB_MAXHOVERTH = 0.0001;
const double PB_ISP = 2.5e5;
const double FUELMASS = 1000;

cpp.
Code:
	PROPELLANT_HANDLE ph_vernier = CreatePropellantResource(FUELMASS);

	// lox vent
	
	//// LOX vent streams
	th_vapour = CreateThruster(vapourlocation[0], _V(1, 0, 0), PB_MAXHOVERTH, ph_vernier, PB_ISP);
	//AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);
	//AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);
	
	
}



void SLSTOWER::clbkPostStep(double simt, double simdt, double mjd)
{
	
	//SetThrusterRef(th_vapour, vapourlocation[0]);
	
	xp0 = vapourlocation[1] - vapourlocation[0]; normalise(xp0);
	xr0 = vapourlocation[2] - vapourlocation[0]; normalise(xr0);
	SetAttachmentParams(vapor1, vapourlocation[0], xp0, xr0);
	
	
	
	SetThrusterRef(th_vapour, vapourlocation[0]);
	
	
	if (vapouryes == 1)	AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);//turn on exhuaust
	if (vapouryes == 0)	DelExhaustStream(th_vapour);//turn off exhuast
 

Attachments

  • multipleexhaust.jpg
    multipleexhaust.jpg
    395.5 KB · Views: 8

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
1
Points
0
Location
San Diego
You're defining the exhaust stream location sperately from the thruster location. The two will not remain bound if you do that.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
First of all: Use a constant offset to the thruster location for the exhaust stream. Move only the thruster, Orbiter will move the exhaust stream.

Second: Don't add a new exhaust stream in EVERY timestep and don't delete it every timestep.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
Thanks.

So I have this:
Code:
void SLSTOWER::clbkSetClassCaps(FILEHANDLE cfg)
{
...	th_vapour = CreateThruster(vapourlocation[0], _V(1, 0, 0), PB_MAXHOVERTH, ph_vernier, PB_ISP);
	AddExhaustStream(th_vapour, vapourlocation[0], &contrail_vapour);
}

void SLSTOWER::clbkPostStep(double simt, double simdt, double mjd)
{
	
	
	
	xp0 = vapourlocation[1] - vapourlocation[0]; normalise(xp0);
	xr0 = vapourlocation[2] - vapourlocation[0]; normalise(xr0);
	SetAttachmentParams(vapor1, vapourlocation[0], xp0, xr0);
	
	
	
	SetThrusterRef(th_vapour, vapourlocation[0]);

I can see the thruster is moving but the exhaust stream remains the same
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
You now have as initial position 2 * vapour_position[0] for the exhaust stream. Why are you not doing what I am saying?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
Sorry. I didn't see that part.

So do you mean like this:
Code:
AddExhaustStream(th_vapour, _V(-16.88219, 6.607, -3.882331), &contrail_vapour);//
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
Sorry. I didn't see that part.

So do you mean like this:
Code:
AddExhaustStream(th_vapour, _V(-16.88219, 6.607, -3.882331), &contrail_vapour);//

No.

Start with "_V(0,0,0)" for the beginning.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
I am not understanding, hard to believe isn't it.:dry:

Ok you mentioned off set and start with _V(0,0,0) for the beginning.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,056
Reaction score
1,756
Points
203
Location
Langendernbach
I am not understanding, hard to believe isn't it.:dry:

Ok you mentioned off set and start with _V(0,0,0) for the beginning.

Yes. You might read the fine manual for understanding the functions that you use better.

The offset in AddExhaustStream is the offset relative to the thruster, not relative to the CoG.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
7,609
Reaction score
1,754
Points
203
Location
Dallas, TX
Ok. Will do. Thanks.

So What if I want the exhaust stream not to have an offset. That it matches the location of the thruster. Couldn't use the same location value?
 
Top