I have a piece wise track made out of Catmull Rom splines. I originally crossed the tangent vector with (0,0,1), then the result of that crossed with the tangent to get the normal vector. However, this doesn't work when the track makes a loop because the normal flips whenever the axes it originally pointed in changes direction, or no normal at all when it's completely parallel to (0,0,1). I initially had the first cross product cross with the normal vector of the previous segment of track, and this worked wonderfully, but it can only change in one direction (|x|,z) or (|y|,z) or the previous normal will start rotating the next normal.
Asked
Active
Viewed 453 times
1
-
1This is a 3D spline, or a 2D one? – bubba Oct 03 '15 at 07:23
-
1This is 3D, sorry for not updating, but I figured it out by adding a general initial cross vector. So a straight track is up. Turning from x to z would be -x initial cross, so it's fixed, it's just weird how there is absolutely no math for this concept, and you have to do everything piece wise while specifying the initial up vector to cross forward with. – cj1094 Oct 03 '15 at 21:14