You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to how elliptical orbits are drawn,
it creates an array of points for a hyperboilc trajectory, from SOI entry to SOI exit. these points do not change throughout the objects movement.
as the object moves (each physics tick) it finds and updates _index variable to match which point in the above array is closest to the objects position.
each frame it updates an array of SDL points, from the _index to the end of the trajectory, for camera position and zoom.
it then iterates through this array drawing a line and reducing the alpha.
This has been fraught with problems, it's one of those things that on the surface should be very easy, but runs into all sorts of edge cases when dealing with angles, and I'm sick of looking at it.
its sometimes drawing a line to screen 0,0
it's sometimes not drawing to the correct length (eg end of SOI).
UpdateUserSettings function needs to be better so the user settings are properly handled.
There's probably a better way to get the closest point to the object, currently we're going to the next point or previous point so we start drawing from behind the ship, but the point may already be behind the ship meaning we're skipping a point. the way we're finding this is probably not the most efficient either.
This is the class that does the work for drawing hyperbolic trajectories:
https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/Pulsar4X.Client/OrbitalWidgets/OrbitHyperbolicIcon2.cs
Similar to how elliptical orbits are drawn,
it creates an array of points for a hyperboilc trajectory, from SOI entry to SOI exit. these points do not change throughout the objects movement.
as the object moves (each physics tick) it finds and updates
_index
variable to match which point in the above array is closest to the objects position.each frame it updates an array of SDL points, from the _
index
to the end of the trajectory, for camera position and zoom.it then iterates through this array drawing a line and reducing the alpha.
This has been fraught with problems, it's one of those things that on the surface should be very easy, but runs into all sorts of edge cases when dealing with angles, and I'm sick of looking at it.
I suspect the first two problems are probably just array length issues.
for testing other angles you can mess around with the start position of the ship here: https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/GameEngine/Engine/Factories/DefaultStartFactory.cs#L418
The text was updated successfully, but these errors were encountered: