Jump to content

How to get the velocity vector of a vessel in the Global world?


Recommended Posts

As the title suggests, how could I get access to a vessel real speed (not the current SOI) but the one in the universe? The value should remain the same when crossing the SOI between celestial bodies

My best attempt was this

        private double GetWorldVelocity()
        {
            var velocity = vessel.orbit.GetWorldSpaceVel();
            var iDepth = 0;

            var celestrialBody = vessel.mainBody;

            while (iDepth < 10 && celestrialBody != null)
            {
                if (celestrialBody.orbit != null)
                    velocity = velocity + celestrialBody.orbit.vel;
                else
                    break;

                celestrialBody = celestrialBody.referenceBody;
                iDepth++;
            }

            return velocity.magnitude;
        }

Although this better than standard velocity, there are still differences what it should be.

 

 

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...