UKismetMathLibrary::TransformDirection
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Rotates a direction vector by the transform's rotation without applying translation or scale, preserving its length. Use this to convert a local-space facing direction to world space.
Caveats & Gotchas
- • Translation and scale from T are deliberately ignored — this is a rotation-only operation. If you need the full point transformation (including offset and scale), use TransformLocation instead.
- • The output length matches the input length only when the transform has uniform scale of 1; with non-unit scale the direction will be scaled too, because internally FTransform applies scale to direction vectors. Normalise the result if a unit direction is required.
Signature
static UE_INL_API FVector TransformDirection(const FTransform& T, FVector Direction) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| T | const FTransform& | The transform whose rotation defines the space change. | — |
| Direction | FVector | The direction vector to rotate, in the source space. | — |
Return Type
FVector Example
Get the world-space forward direction of a component C++
FVector LocalForward(1, 0, 0);
FVector WorldForward = UKismetMathLibrary::TransformDirection(
MeshComp->GetComponentTransform(), LocalForward
);
// Equivalent to MeshComp->GetForwardVector() for uniform-scale meshes Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?