UKismetMathLibrary::Quat_SetComponents
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Directly assigns all four XYZW components of a quaternion. Used when raw quaternion values are already known (e.g. from network packets, animation data, or physics engines).
Caveats & Gotchas
- • This does not normalize the result. If the source values are not guaranteed to form a unit quaternion, call Quat_Normalize afterward. Non-unit quaternions will produce incorrect rotation results when used in transforms.
- • The component order is (X, Y, Z, W) matching FQuat's memory layout, but differs from some external formats (e.g. glTF stores XYZW while some physics engines store WXYZ). Verify source ordering before calling.
Signature
static UE_INL_API void Quat_SetComponents(UPARAM(ref) FQuat& Q, float X, float Y, float Z, float W); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | FQuat& | The quaternion to modify in-place. | — |
| X | float | Imaginary X component. | — |
| Y | float | Imaginary Y component. | — |
| Z | float | Imaginary Z component. | — |
| W | float | Real W component. | — |
Return Type
void Example
Reconstruct a quaternion from network data C++
float NetX, NetY, NetZ, NetW;
ReceiveQuatComponents(NetX, NetY, NetZ, NetW);
FQuat ReceivedQuat;
UKismetMathLibrary::Quat_SetComponents(ReceivedQuat, NetX, NetY, NetZ, NetW);
UKismetMathLibrary::Quat_Normalize(ReceivedQuat); // Safety normalize
SetActorRotation(ReceivedQuat.Rotator()); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?