07-26-2018, 03:05 PM
hmmm, I'm hoping there's a procedural approach rather than having to manually adjust every control point. For context, let's imagine a 2D rollercoaster where the course is procedurally generated. I'm trying to keep the car on the same side of the track regardless of uphill, downhill, or loopDeloop. I've succeeded in created the spline dynamically, and getting the car to follow the spline. But the sprite keeps rotating in 3D space around the 2D spline on some, but not all, curves. When I inspect the spline, it is correct when the spline orientation is on the 2D plane, and incorrect when the orientation blends to 3D.
I'm setting my splineController orientation Source to Tangent and my Target to Forward, which is what I assumed to be the right approach to keep my cars on the correct side of the track. But it seems like the splineController is calculating the tangent from the 3D orientation of the spline for some reason.
In the attached pic, you'll see the car going up the track, and the spline orientation is pointing to the right. Then, instead of continuing to point to the outside of the trackĀ , the orientation starts to rotate to the left, which makes the sprite rotate in 3D space ("get skinny") and switch sides of the track.
I'm hoping there's a setting I've got wrong, that would keep this in pure 2D procedurally.
I'm setting my splineController orientation Source to Tangent and my Target to Forward, which is what I assumed to be the right approach to keep my cars on the correct side of the track. But it seems like the splineController is calculating the tangent from the 3D orientation of the spline for some reason.
In the attached pic, you'll see the car going up the track, and the spline orientation is pointing to the right. Then, instead of continuing to point to the outside of the trackĀ , the orientation starts to rotate to the left, which makes the sprite rotate in 3D space ("get skinny") and switch sides of the track.
I'm hoping there's a setting I've got wrong, that would keep this in pure 2D procedurally.