branchrust_reboot/main/rail_network/wheel_tangentscancel
27 Commits over 0 Days - ∞cph!
Manifest update for train carriage entity
Add a train carriage for testing
Renamed BaseTrain to TrainCar for clarity
Fixed incorrect GetDistance results for splines <40m long
Fixed incorrect height on some train track spline prefabs
Added float interpolator implementation. Simplified the generic interpolator code - no need for separate interpolator classes anymore, only separate entry types.
World spline shared data update
Made my interpolator generic. The original TransformInterpolator now inherits from it.
Added a float interpolator based on TransformInterpolator
Updated WorldSpline Prefab Shared Data to my newer lookup-table generating system
Send bogie rotation data as an RPC instead of full network syncs
Made GetDistance (used when spawning trains) around 3x faster. That's Good Enough™
Rewrote the lookup-table building and the GetPointAndTangentCubicHermite method for WorldSplineData - my previous attempt at a performance speedup was returning wrong values since spline estimated length doesn't usually quite match real-world length. There is almost certainly still a better implementation out there than what I'm committing here, but this works and is lightning fast.
New faster code for the GetDistance method
Eliminated the second step in TryFindTrackNearby. Will initially place spawned trains slightly less accurately but should be fine.
Greatly improved the speed of GetPointAndTangentCubicHermite for long single spline track pieces. Instead of looping through every LUT entry to find the closest distance, calculate where exactly it will be using known data. No more loop. Also fixes incorrect use of prevPos, which wasn't being set beyond its starting value.
Some tidy-up and formatting
Fixed wheel bogie rotation issues, and saved on network data by sending a float for bogie Y rotation instead of a full Vector3
Fixed trains sitting in the wrong place on the tracks if the centre of the train wasn't exactly between the two wheels, but now the bogie angle ends up wrong. Need to think about this some more
Added a new train engine made out of cube primitives and stuff
Fixed train wheels rotating in the wrong direction if the train had bogie rotation enabled and was facing in reverse direction on the track. Flip the tangent if the train if facing backwards.
Prevent "look rotation viewing vector is zero"
Made independent bogie rotation optional and disabled it for WorkCart (the model isn't designed for it).
Base the calculated WorkCart track positions on the pivot points of the front and rear bogies. Wheel bogies now align perfectly on curves.
Small merge from rail_network to wheel_tangents
Fixed train track splines not always updating their data when changing them in editor
Server now determines and sends tangent data for the front and rear wheels, allowing the client to rotate the wheel bogies to match the angle of the track. Added to WorkCart. This still has some issues to sort out so committing to a branch for now.