Jump to content

Cheetah_stuck_in_space

Members
  • Posts

    1
  • Joined

  • Last visited

Reputation

1 Neutral
  1. Right now im still learning the mechanics of KOS, and while doing this i was trying to use air drag to calculate throttle during ascent. But when i started searching online i coulnd't find any proper scripts to do this, apart from the ones before 1.0. Everyone was saying that you couldnt calculate it now because we don't know the Cd value of ships anymore. But you can actually calculate it on the fly using: Thrust vector + Gravity Vector + Drag vector = total force on ship(Vector). After puzzling for a while with vectors i managed to come up with this script which returns the drag as the vector AirResVec: Important notes!!: Doesn't work while landed because the script will think the drag is keeping the craft from falling instead of the ground its standing on(edit: now fixed by adding a failsafe that will return 0 drag if the ship is either landed, not launched yet or splashed down) There is a slight delay when changing the throttle which will cause the air drag vector to freak out for a split second You need an accelerometer on the craft to calculate the (wait for it...) acceleration.(edit: these two issues are now fixed by using the KO's built-in ship:velocity instead of ksp's accelerometer which averages the acceleration from the last 0.4 seconds which caused glitches) I hope this helps the community since the script wasnt available when i needed it. BTW. here is a pictures of the vectors in action:
×
×
  • Create New...