So I have a game where I’m trying to grind along a spline and the direction you go along it can change depending on the angle of entry. The direction works fine, I used vectors and dotproduct, all’s well. The problem is setting the rotation of the player properly when going backwards if the rail is set at an angle.
Here’s how I’m setting the rotation:
FRotator NewRot = grindSpline->GetRotationAtDistanceAlongSpline(distAlongSpline, ESplineCoordinateSpace::World);
SetActorRotation(NewRot);
If the rail’s angle is 0, SetActorRotation(NewRot.GetInverse()) works. However if the rail object is at an angle, it doesn’t. Going forward works perfectly no matter what, the inversion breaks when the object is at an angle. I don’t understand what’s going on or how to rectify the situation.
Any suggestions would be appreciated.