Jump to content

Calculate weight of vessel ?


Recommended Posts

I have mainBody.gravParameter and the vehicle mass. How do I calculate the vehicle weight from that ?

edit: I don't think mainBody.gravParameter is what I thought it was. Where can I get the current gravitational acceleration ?

Edited by pixartist
Link to comment
Share on other sites

You have to come at this backwards because I believe KSP cheats and simply accelerates everything in m/s to simulate the force of gravity.

So, as follows:


//3 lines known good as I use them myself in my velocity control mod
VesselMass = Vessel.GetTotalMass(); //vessel mass, including resources
GravHeight = (float)Vessel.altitude + (float)VesselSOI.Radius; //distance to calculate gravity force, is altitude from body center
GravAccel = (float)TWR1SOI.gMagnitudeAtCenter / (float)Math.Pow(TWR1GravHeight, 2); //accel down due to gravity in m/s^2, can't remember where i found this formula but it works

//don't use this line myself, but it's straightforward math, only catch is if KSP uses the same units I'm thinking it does
VesselGravForce = GravAccel * VesselMass; //should be gravity's force in newtons on your vessel

Hope that helps,

D.

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...