Problem TU50/50 suborbital plane

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
217
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
Hi guys ,i'm italian and sorry for my bad-english (i'm used translator :D )

This is the my next add-on
anonimob.jpg

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 )
anonimo2.jpg
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
Addon Developer
Joined
Aug 15, 2008
Messages
6,402
Reaction score
445
Points
173
Location
Among bits and Bytes...
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

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
217
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
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
Joined
Apr 27, 2008
Messages
213
Reaction score
80
Points
43
Location
Moscow
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
Addon Developer
Joined
Aug 15, 2008
Messages
6,402
Reaction score
445
Points
173
Location
Among bits and Bytes...
In which case:

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

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

Addon Developer
Addon Developer
Donator
Joined
Apr 3, 2008
Messages
424
Reaction score
0
Points
31
Location
Palmdale
Website
www.worldof2001.com
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

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
217
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
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?

Hi sputnik,i love all your add-on

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
spiralb.png
this is my mesh for Spiral
 

the.punk

Advanced Orbinaut
Joined
Nov 3, 2008
Messages
1,026
Reaction score
0
Points
0
The mesh looks very cool.:speakcool:
 
Top