# ProblemTU50/50 suborbital plane

#### marcogavazzeni

Hi guys ,i'm italian and sorry for my bad-english (i'm used translator )

This is the my next add-on

but i have a little problem with a contrail-texture..​
I would want to emulate the contrail real ,than under a sure height they are not visible (vapour trails or contrails usually occur above 8000 metres (26,000 feet). where the temperature is below -40°C )
But is a problem ..
I have used this code in order to try to resolve the problem

if (GetAirspeed() >= 600)
{
SetThrusterMax0 (th_hover ,0.1);
SetThrusterLevel (th_hover,0.1);
SetThrusterGroupLevel (th_hover,0.1);

}
if (GetAirspeed() <= 600)
{
SetThrusterMax0 (th_hover ,0);
SetThrusterLevel (th_hover, 0);
SetThrusterGroupLevel (th_hover, 0);

}
if (GetAltitude() >= 8000)
{
SetThrusterMax0 (th_hover ,0.1);
SetThrusterLevel (th_hover,0.1);
SetThrusterGroupLevel (th_hover,0.1);

}

if (GetAltitude() <= 8000)
{
SetThrusterMax0 (th_hover ,0);
SetThrusterLevel (th_hover, 0);
SetThrusterGroupLevel (th_hover, 0);

}

The coordinates of push of the HOVER are equal to those of the MAIN, therefore when l' airplane exceeds the 8000 meters of height appears the contrail, and when it comes down disappear, the problem is when I extinguish the motors beyond the 8000 meters the contrail remain, would serve one code x to make me to work MAIN and HOVER in parallel, so that if I extinguish motors MAIN the contrail disappear also, also when l' airplane exceeds the 8000 mt of altitude
Someone can help me please?

#### RisingFury

##### OBSP developer
Your if statements are all wacky...

I'm guessing you want the contrails to appear only at 8000 m or above and at an airspeed of 600 m/s or above, in which case:

Code:
if ((GetAirspeed() >= 600) && (GetAltitude() >= 8000))
{
// Set thruster level to 0.1 for contrails.
}

else
{
// Set thruster level to 0 for no contrails.
}

Although a more... clean... approach would be to set the thruster levels only if you breached a condition that frame, as opposed to setting it every frame...

#### marcogavazzeni

Your if statements are all wacky...

I'm guessing you want the contrails to appear only at 8000 m or above and at an airspeed of 600 m/s or above, in which case:

Code:
if ((GetAirspeed() >= 600) && (GetAltitude() >= 8000))
{
// Set thruster level to 0.1 for contrails.
}

else
{
// Set thruster level to 0 for no contrails.
}

Although a more... clean... approach would be to set the thruster levels only if you breached a condition that frame, as opposed to setting it every frame...

Yes ...when i used your code,but when i'm stop the MAIN thrust over 8000 mt the contrails remain,

I want that when stop the MAIN I stop myself also the HOVER(and the contrails) independent from the altitude or speed.
Sorry for my bad english

#### DarkWanderer

##### Active member
Orbiter Contributor
Donator
Maybe you'll just want to use AddExhaustStream and DelExhaustStream when transiting these conditions?..
Otherwise, exhausts will appear if one presses and holds the Num0 button.

#### RisingFury

##### OBSP developer
In which case:

Code:
PSTREAM_HANDLE Contrail = -1; // Define this in your vessel header
Code:
if ((GetAltitude() >= 8000) && (GetAirspeed() >= 600))
{
if (Contrail < 0)
{
}
}

else
{
if (Contrail >= 0)
{
DelExhaustStream(Contrail);
Contrail = -1;
}
}
I'm assuming -1 is an invalid handle and 0 is valid. If 0 is invalid, just modify the if statements to exclude it...

#### sputnik

Donator
Oh, good. I'd like to see a more-detailed treatment than the one I did: [ame="http://www.orbithangar.com/searchid.php?ID=1461"]Spiral 1.0[/ame]

Are you working on just the airplane itself, or the entire piggyback rocket and Spiral spaceplane system?

#### marcogavazzeni

Oh, good. I'd like to see a more-detailed treatment than the one I did: Spiral 1.0

Are you working on just the airplane itself, or the entire piggyback rocket and Spiral spaceplane system?

the plan was to make the space glides down suit, all' beginning we were in three, but I am remained single to continue. I am not much practical one to use VC++ and have a difficulty to compile the DLL, if someone is wanted to be joined in order to continue the plan is welcome
this is my mesh for Spiral

#### the.punk

The mesh looks very cool.:speakcool:

Replies
3
Views
2K
Replies
1
Views
1K
Replies
2
Views
2K
Replies
5
Views
3K
Replies
5
Views
2K