I have a straightforward question in theory, but it’s a bit more complex in practice. I’m working on a project that aims to develop a track plugin for creating tracks and railways more efficiently. Before diving into the larger aspects of the plugin, I’d like to understand the fundamentals of creating a path between two points.
While I know that using magnitude calculations is a common approach, I’m looking for a method that can be used for more advanced applications down the line.
To give you a clearer idea of what I’m envisioning, I’ve created a visual representation of the desired path in Photoshop:
Yellow Blocks at each point is the front face of each part.
It’s also important that the parts follow each other in a smooth curve, rather than all maintaining the same rotation, which would make them look like a pixelated path.
Any guidance on how to start this process or code snippets that could help would be greatly appreciated!
I see, that’s really interesting! However, this method uses three points to create a curve. Is it possible to create a curve using only two points? From what I understand in this video; with just two points, it would normally result in a straight line rather than a curve.
The Cities: Skylines example is a great comment! Not just for their roads, but especially for their railways, which interest me more. I’ve looked into it, but I’m still unsure how to approach this using splines. Creating a path with just two points, where parts follow each other, seems quite challenging. There are several types of splines to explore, so it looks like I’ll need to dive deeper into understanding how they work.
Using Bézier curves and having the script automatically calculate where the control points should be is an option. This way, the result in the orange box will match (c), and the blue box will align with (a). However, achieving the result in (b) might be more challenging. However, all of this what I just said is challenging (but possible!)
Hello I have made a track placement plugin before it does not involve bezier curves you have to use something called a catmull rom spline and there is a post on the devforum for it somewhere