API Question AddExhaust Directions

Zane

New member
Joined
Jun 13, 2009
Messages
41
Reaction score
0
Points
0
Location
Dublin, Ohio
I've got a question about the Vessel::AddExhaust method.

In my vessel, I've got this bit of code:
Code:
    Main[0] = this->CreateThruster (_V(0,0,0), _V(0,0,1), S1MAXMAINTH, MainProp, S1ISP);
    Main[1] = this->CreateThruster (_V(1,0,0), _V(1,0,1), S1MAXMAINTH, MainProp, S1ISP);
    Main[2] = this->CreateThruster (_V(0,1,0), _V(0,1,1), S1MAXMAINTH, MainProp, S1ISP);
    Main[3] = this->CreateThruster (_V(-1,0,0), _V(-1,0,1), S1MAXMAINTH, MainProp, S1ISP);
    Main[4] = this->CreateThruster (_V(0,-1,0), _V(0,-1,1), S1MAXMAINTH, MainProp, S1ISP);

    this->AddExhaust (Main[0], 8 * 10, 1 * 10, _V(0,0,0), _V(0,0,-1));
    this->AddExhaust (Main[1], 8 * 10, 1 * 10, _V(1,0,0), _V(1,0,-1));
    this->AddExhaust (Main[2], 8 * 10, 1 * 10, _V(0,1,0), _V(0,1,-1));
    this->AddExhaust (Main[3], 8 * 10, 1 * 10, _V(-1,0,0), _V(-1,0,-1));
    this->AddExhaust (Main[4], 8 * 10, 1 * 10, _V(0,-1,0), _V(0,-1,-1));
It's supposed to make 5 engines and assign give exhaust textures to each of them, with each exhaust billboard thing facing directly down. However, the exhaust faces outward for some reason. Does anyone know how to remedy this?

-Zane
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,663
Reaction score
2,383
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Why do you use this version of AddExhaust at all? Leave the vectors away and just use the version

AddExhaust(thruster, length, width, linear_offset, texture)

The linear offset is just a distance against the direction vector of the thrust force, so you can place the exhaust at the end of the nozzle, if the thrust attaches actually to the top of the nozzle extension.

As you have one exhaust per logical thruster, this should be a better solution.

Also, your direction vectors are wrong. They should be magnitude 1.0, you must normalize them.

(1,0,1) -> Magnitude is sqrt(1² + 1²) = sqrt(2) ---normalize---> (1/sqrt(2), 0, 1/sqrt(2))
 

Zane

New member
Joined
Jun 13, 2009
Messages
41
Reaction score
0
Points
0
Location
Dublin, Ohio
Thanks! :)
Although I didn't go directly with the route you suggested (There doesn't seem to be such an overload for the AddExhaust method), I got everything working now so all the engines and exhaust streams face the right way.

However, I'm encountering another unrelated problem. When I set my touchdown points like this:
Code:
SetTouchdownPoints(_V(1,0,0), _V(-1,1,0), _V(-1,-1,0));
The craft is pointing down when on the pad (down as in -90 pitch). Is there a way to fix this? If so, how would I do it?
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
However, I'm encountering another unrelated problem. When I set my touchdown points like this:
Code:
SetTouchdownPoints(_V(1,0,0), _V(-1,1,0), _V(-1,-1,0));
The craft is pointing down when on the pad (down as in -90 pitch). Is there a way to fix this? If so, how would I do it?
Your points are all coplanar in the xy plane.

The Orbiter axes are X-right, Y-up, Z-forward.

In order for your model to sit properly, your touchdown points need to be coplanar in the xz plane.
 

Zane

New member
Joined
Jun 13, 2009
Messages
41
Reaction score
0
Points
0
Location
Dublin, Ohio
I probably should have mentioned this before, but it's a rocket, not a spaceplane type thing, so it needs to be pointing up. How would it work then?
 
Last edited:

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,580
Reaction score
2
Points
0
I probably should have mentioned this before, but it's a rocket, not a spaceplane type thing, so it needs to be pointing up. How would it work then?
So the rocket's "forward" direction is the +z, you just want it to be pointing "up" when on the ground?

Is the problem that it's "laying flat" on the pad rather than "pointing up", or that it's "pointing down"?

If it's "pointing down" try reversing the order of the second pair of points in SetTouchdownPoints.

IE,
Code:
SetTouchdownPoints(_V(1,0,0), _V(-1,-1,0), _V(-1,1,0));
instead of what you have.
 

Zane

New member
Joined
Jun 13, 2009
Messages
41
Reaction score
0
Points
0
Location
Dublin, Ohio
Yeah, that's perfect. Thanks so much! :)

I never would have considered that left/right touchdown points were not interchangeable (pretty stupid of me, now that I come to think about it).

Anyway, I tried to get my rocket into orbit, but it would shake really violently before it could get anywhere. I've figured out it's the rotational drag, but there's nothing I can do about it other than commenting the drag out.
 
Top