Jump to content

Search the Community

Showing results for tags 'positioning'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements
    • Welcome Aboard
  • Kerbal Space Program 2
    • KSP2 Dev Updates
    • KSP2 Discussion
    • KSP2 Suggestions and Development Discussion
    • Challenges & Mission Ideas
    • The KSP2 Spacecraft Exchange
    • Mission Reports
    • KSP2 Prelaunch Archive
  • Kerbal Space Program 2 Gameplay & Technical Support
    • KSP2 Gameplay Questions and Tutorials
    • KSP2 Technical Support (PC, unmodded installs)
    • KSP2 Technical Support (PC, modded installs)
  • Kerbal Space Program 2 Mods
    • KSP2 Mod Discussions
    • KSP2 Mod Releases
    • KSP2 Mod Development
  • Kerbal Space Program 1
    • KSP1 The Daily Kerbal
    • KSP1 Discussion
    • KSP1 Suggestions & Development Discussion
    • KSP1 Challenges & Mission ideas
    • KSP1 The Spacecraft Exchange
    • KSP1 Mission Reports
    • KSP1 Gameplay and Technical Support
    • KSP1 Mods
    • KSP1 Expansions
  • Community
    • Science & Spaceflight
    • Kerbal Network
    • The Lounge
    • KSP Fan Works
  • International
    • International
  • KerbalEDU
    • KerbalEDU
    • KerbalEDU Website

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Twitter


About me


Location


Interests

Found 1 result

  1. Hi, in order to implement a safer interpolation mechanism on LMP I store the orbital positions in a queue and replay them after 2 seconds have passed. The code looks something like this: var startTime = KspOrbit.epoch; var targetTime = Target.KspOrbit.epoch; var currentPos = KspOrbit.getRelativePositionAtUT(startTime); var targetPos = Target.KspOrbit.getRelativePositionAtUT(targetTime); var currentVel = KspOrbit.getOrbitalVelocityAtUT(startTime) + KspOrbit.referenceBody.GetFrameVelAtUT(startTime) - Body.GetFrameVelAtUT(startTime); var targetVel = Target.KspOrbit.getOrbitalVelocityAtUT(targetTime) + Target.KspOrbit.referenceBody.GetFrameVelAtUT(targetTime) - Target.Body.GetFrameVelAtUT(targetTime); var lerpedPos = Vector3d.Lerp(currentPos, targetPos, LerpPercentage); var lerpedVel = Vector3d.Lerp(currentVel, targetVel, LerpPercentage); Vessel.orbit.UpdateFromStateVectors(lerpedPos, lerpedVel, LerpBody, Planetarium.GetUniversalTime()); KSPOrbit is the first packet Orbit, Target.KSPOrbit is the next packet, and on every fixed update frame that code is called. In order to ignore FlightIntegration issues I only call this when vessels are PACKED (OnRails) (I will deal with FI later) The LerpPercentage is a value between 0 and 1 that increases on every fixedupdate call The movement is very fluid BUT the positions are displaced kind of "backwards" This is for example a screenshot I took with 2 clients side by side: Here the player 1 is flying above that wide line in the runway: https://imgur.com/0oPcYHH But the player 2 sees this: https://imgur.com/HlEmoxJ I understand the GREEN distance as the vessel is 2 seconds behind and it will take some time to reach the runway but I don't understand why it's displaced sideways (red distance) Also, I tried to set this code: var lerpTime = LunaMath.Lerp(startTime, targetTime, LerpPercentage); Vessel.orbit.UpdateFromStateVectors(lerpedPos, lerpedVel, LerpBody, lerpTime); But then the orbit is rendered in real time (not 2 seconds behind in time) and the vessel goes inside Kerbin a lot of times and there are weird movements. I think there's some orbital calculation that I'm missing but I can't find how should I proceed on this... I even tried specifying the position manually as: Vector3d vector3d = Vessel.orbitDriver.driverTransform.rotation * Vessel.localCoM; Vessel.SetPosition((planetPos + Vessel.orbitDriver.pos) - vector3d); But I didn't had luck Does someone have an idea of how I should implement this? It's honestly one of the oldest LMP bugs and I've been dealing with this for months and not making much progress. EDIT: If I reduce the interpolation delay time to 300ms or so the movement is almost perfect (there's still that sideway distance altough much shorter) but I want to set a 1 or 2 seconds delay for bad connections
×
×
  • Create New...