Rotation Overhaul / Quaternions

Dealing with Rotations in any engine is always a big hassle as the math behind it is not simple, but in Crayta it feels especially arduous to me. Like, every project every time I try to do anything I run up to weird behavior. It seems like gimbal lock is unavoidable and every attempt to do something more advanced runs into strange, inexplicable behavior.

As an example of my most recent challenge: I would like to rotate something 45 degrees around an arbitrary Vector axis. In Unity I could use Transform.RotateAround, or quaternions. I believe Unreal Engine makes it simple with RotateVectorAroundAxis. I would love to have access to that. Now, instead of a simple api call, I think with some okay reliability you can take an entity, set its forward to be the vector axis you want to rotate around, then take a child entity, oriented so you can rotate its yaw or roll because pitch still does strange things, rotate its relative rotation by 45, and then take its non-relative rotation and use that with the original thing you wanted to rotate.

Of course, that’s assuming you have an entity you wanted to rotate and you didn’t just want a rotated vector. Maybe instead of grabbing its world space rotation I should grab its GetForward(), but then that’s stacking layers of work arounds on work arounds. It’s really lovely being able to do Rotation.FromVector() to get a rotation from a vector, but how about the opposite? Again you can do tricks with setting another entity to the rotation you want and get its Forward vector, but it would be really sweet to have an api call and not have to manipulate a spare locator for this kind of thing.

Adding or subtracting Rotations from each other doesn’t seem to work as intuitively as vectors do, it’d be great to have some way to compare how relatively different on some axis (even one of the worldspace ones) one rotation is from another, but since certain adjustments to pitch, yaw, or roll will change the other two, that comparison is, if not mathematically impossible, certainly difficult enough that an api call would be extremely helpful.

Other people have suggested quaternions to help, and my understanding is those would make a huge difference and perhaps that’s the way to go. If I knew the solutions it probably wouldn’t be a problem in the first place for me :sweat_smile: but in general I’d really love it if you could take a deep dive into giving the Rotation side of things more usability

3 Likes