Planet Height From Sun

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
How do you find the hight of a planet in reference to the sun?

oapiGetRelativePos should do it, you'll have to subtract the radius of the planet and the sun.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,621
Reaction score
2,341
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Orbital radius of the planet - diameter of the sun? Or what do you mean?
 

Ursus

Rocket Tinker
Addon Developer
Joined
Oct 20, 2007
Messages
176
Reaction score
2
Points
18
Location
46N 123W
I dunno... since the sun is directly at the center of the global coordinate system, I don't bother... I just use oapiGetGlobalPos() (well, actually, I've just used it for vessels, so I use VESSEL2::GetGlobalPos()).

I guess if you need to find the radius of the sun or something... yeah, I think oapiGetObjectByName("sun") should work. (Hmmm... I wonder if the sun always has the same index...)
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Assuming the star to be the sun would make your vesse/mfd non-functional with other planetary systems. The best course of action in my opinion is to use the following functions in conjunction.

oapiGetObjectCount
oapiGetObjectByIndex
oapiGetObjectType - if it returns OBJPT_STAR, your object is a star
 
Top