When trying to pass a vector to a rotator, by default it creates a “Rotation from XVector” conversion:
This is a weird conversion imo, shouldn’t there be a default one that just grabs (x, y, z) and turns it to a rotator with (roll=x, pitch=y, and yaw=z)?
Also, when you try to create a rotator (Make Rot), the parameters are in a different sequence, which is very error prone:
In your blueprint, why use the vector values to make a rotator? The vector values are ranged from -NaN to NaN, but the rotator values are ranged from -180 to 180. What you need is to clamp the X, Y, and Z values to a number between -180 and 180, and then make the rotator using those clamped numbers.
It doesn’t work that way, the Make Rot From X is a way to make a rotator in world-space based on a vector pointing in a direction. It’s very useful. If you want the long version, it converts a rotation matrix generated from a vector into a rotator.
There’s very few scenarios where you’d want to directly convert a Vector’s elements to a rotator. Strictly speaking that doesn’t really translate to anything useable that I can think of…
@asperatology the reason for it is that I’m using a timeline to animate the rotation, and the problem is that timelines only support vectors, colors, and floats. So basically I’m making the rotation through the vector.
Yes, I understand that for some situations that function makes sense, but I’m just wondering if that should be the default conversion.
Really? I use this use case all the time, because some times Rotation is exposed as a vector (pretty sure this started when exposing a Quaternion in Unity showed the x,y,z,w components, not sure if it still does it now tbh), or some times I even expose just a float when the rotation is just on a certain axis.
In any case, having them out of order on Make Rot feels like an oversight to me.
I never used Make Rot From… really, since it does not say what it does and how it works in the documentation, except for the one-liner.
Wouldn’t you need a rotation angle associated with the vector to convert a vector pointing in a direction into a rotator? The vector alone is not enough, right?. But instead you need axis&angle (i.e. vector and ‘screw’ angle) to convert to a rotation matrix.
The whole make rot from thing is another example of stuff that gets coded and implemented, but not documented properly and as such, the majority of users won’t use it. Here we say: ‘then why code it first place’.
Well…the dark and unknown space that is rotations&UE4…
Well it’s self-explanatory. Say you have a vector that points in a direction, you use ‘Make Rot From X’ and apply that rotator to an object in World-Space. The object’s X-axis will now be facing the same direction that the vector was pointing.
You can use Make Rot From XY or other multiple angles, to force orthogonality and therefore get completely correct rotators, which is also important in a lot of situations. You COULD use Make from Axis and Angle, but that’s much more long-winded for the end user. The Make Rot From X also uses Quaternion calculations to make the rotator, so you don’t get a resulting rotator that has an unusable value. Like ranging from 180 to -180 for example (to my knowledge anyway).
If you want to use Timelines with Rotators (and there’s no current way), you can simply treat X, Y and Z as your pitch roll and yaw. Functions that produce vectors aren’t at all useful for rotators (for example, there’s no useful translation of ‘Get World Location’ to ‘Make Rot’). However, there’s nothing stopping you storing a rotators values as an FVector, just be aware that it’s not an FVector, it’s an FRotator stored in an FVector container. In fact, I bet at a much lower level in engine, the FRotator is no different to the FVector, but the operations performed on it are different.
The reason the ‘Make Rot From X’ exists is for an easy conversion from a vector to a rotator. If you want an arrow for example that points in a vectors direction, user Make Rot From X on the direction and apply that rotation (in world space) to the arrow.
Thanks for the explaination. I will set up a simple test scene to check it.
It is not really that self explaining. ‘Make Rot from X’ suggests that the X-Axis of the vector is used as the new orientation (object would be rotated along the x of the vector)
‘Make Rot for object x’ would be better. Or just a few more sentences in the documentation, but then it is UE4