How Can I Create a Path of Parts Between Two Points?

Hello everyone,

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!

Thank you!

1 Like

You could try lerping, and for more complex curves, different variants of lerping

Also your examples looks very similar to Cities Skylines roads so you could try researching on how they did it

After a bit of research cities skylines uses Splines

Extra link 1

4 Likes

This video will show you how

5 Likes

Hi,

Thank you for the video—it gave me a useful idea! I was wondering, though, is there a way to ensure that the distance between the spheres is equal?

this method produces a fixed distance between points

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 :roll_eyes: (but possible!)

1 Like

you could use the parts look vector to generate more points

2 Likes

I’m going to try to make something like this. I have no idea how, but I think it will work out fine.

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

1 Like