Block-based "Segmented Spline" Rail System with Kinematic Rigidbody Follower

TheGaminner 002 shared this feedback 24 hours ago
Not Enough Votes

Introduction


Though the idea of a rail system in Space Engineers is not a new topic, I feel it deserves more in depth analyses into how it could possibly function within the limits of both the VRage Engine and the Space Engineers grid-building system. This proposal outlines a feasible implementation based on a kinematic rigidbody (“rail-head”) that traverses a distributed network of rail segments defined locally within individual rail blocks.


Dynamic Rail Blocks


Each rail block stores the start and end points of a vector spline segment as local-space offsets from the block’s center, aligned to its forward axis and transformed into world space via the block’s WorldMatrix. When multiple rail blocks are placed in sequence, their locally-defined segments naturally align through grid snapping and can be dynamically linked to form continuous traversal paths without requiring a centralized spline or path database. By adjusting these local start/end offsets, individual blocks can represent angled or sloped segments, allowing the construction of curves and gradients when adjacent segments are directionally compatible. (Will provide in the future). A kinematic rail-head entity then follows these linked segments by advancing along each segment parametrically and interpolating position and orientation using the segment’s forward and up vectors, effectively “snapping” to the path while maintaining smooth motion. Because all segment data is defined relative to each block and transformed into world space at runtime, the system inherently supports moving and rotating grids, enabling rails to function consistently on dynamic ships as well as static structures. This distributed, segment-based approach ensures scalability, avoids expensive global path recalculation, and remains fully compatible with VRAGE’s physics and grid systems.


Kinematic Rigidbody/Rail-Path Follower ("Rail-Heads")


The rail-head is a kinematic rigidbody entity that traverses the path defined by linked rail blocks, using their locally stored vector spline segments as guides. Its motion is parametrically controlled along each segment, interpolating its position between the start and end points while continuously aligning its orientation with the segment’s forward and up vectors. This ensures smooth traversal through curves, slopes, and angled segments without relying on standard rigidbody inertia, which can introduce instability at high speeds. When reaching the end of a segment, the rail-head automatically transitions to the next linked segment, maintaining its velocity and orientation unless a segment is unavailable or misaligned, in which case it detaches and becomes a free-moving physics object. (Derailment.) The rail-head’s velocity, torque (force applied to other grids in collisions), and height above the track are configurable through the grid’s control interface or programmable logic, allowing players to adjust movement parameters dynamically. Because the rail-head uses the up vector of the underlying rail block as its reference for vertical orientation, it naturally follows moving or rotating grids, and its front direction is preserved even when reversing, enabling smooth forward and backward travel along rail networks.


Rail-Head Logic Control/Power Distribution:


When powered and active, each rail block sets a local boolean flag indicating that it can transmit power to any rail-head occupying its segment. Rail-heads query this state at runtime and will only apply velocity or torque if the underlying block is both powered and active, while remaining fully movable through external forces, shunting, or player interaction when unpowered via simulated collision interactions. Rail-head parameters such as velocity, torque, and height offset are configurable via the grid’s control interface or programmable logic blocks, and settings propagate across all connected rail-heads within the same rail network to maintain consistent behavior. To prevent conflicts or unrealistic behavior, rail-heads cannot be locked in place until their velocity is zero, ensuring safe operation during acceleration, deceleration, or cross-grid transitions. This architecture allows for both manual and automated control of rail networks while integrating cleanly with Space Engineers’ existing power and logic systems.

Replies (3)

photo
1

After doing the research to create this proposal – I am fairly convinced that a rail system in SE1 is possible and tbh, that’s enough for me. I had something I wanted to prove, and until someone disproves this system's feasibility, I feel I’ve done that (at least for now.) Feel free to provide constructive criticism or just comment on what you’d use a system like this for. Cheers – TheGamineer.

photo
1

I have not in fact proved anything. There is much to be done. If I comment here again, it will be because I have a working prototype for a function rail mod.

photo
photo
1

I can't edit this post anymore -- but I need to clarify/edit some things. For one, the rail head likely wouldn’t be directly attached to the rail or handle its own path-finding logic. Just like other mechanical blocks (both modded and otherwise,) this would mainly need to be done via something like an invisible, non-default-physics-conforming dummy that follows the rail-path logic and has a subgrid head attached/teleporting to it every tick for players to build on (this may be jank as heck, but I'll keep looking for better ideas.)


tldr: Each block defines a segment of a path that the rail-head can follow and the rail head is just a non-default-physics-conforming dummy with a sub-grid attached to it players can build on.

photo
1

I realized that it is not possible to create new or utilize existing constraint types in SE1 outside of their dedicated block parts, so I would need to simulate it by overriding the velocity of the railhead to nudge it towards the track and only allow it to smoothly move in the direction the path wants it to move. The rail probably wouldn't power the rail-head in this case so you may need to use thrusters to -- wait a minute. I've heard of this mod before..


And thus I have reinvented the Hover-rails mod. Awesome. There has to be another way to do this, I have to find it!

Leave a Comment
 
Attach a file
Access denied