RealDocs

FVector::RotateAngleAxis

function Core Since unknown
#include "Math/Vector.h"
Access: public Specifiers: const

Description

Returns this vector rotated around the given axis by AngleDeg degrees, using Rodrigues' rotation formula. Does not modify the original vector.

Signature

TVector<T> RotateAngleAxis(const T AngleDeg, const TVector<T>& Axis) const

Parameters

Name Type Description Default
AngleDeg float Angle to rotate by, in degrees.
Axis const FVector& The axis to rotate around. Should be a unit vector.

Return Type

FVector

Caveats & Gotchas

  • Angle is in degrees, not radians — consistent with FRotator but opposite to FMath::Sin/Cos. Easy to mix up when computing Axis from trig functions.
  • Axis should be normalised. Passing a non-unit axis produces a scaled result, not a pure rotation.
  • Internally converts degrees to radians via FMath::DegreesToRadians. Use RotateAngleAxisRad for the raw-radians variant if calling in a tight loop.

Example

Orbit a point around an axis C++
// Rotate the forward vector 45 degrees around the world up axis
FVector RotatedDir = GetActorForwardVector().RotateAngleAxis(45.0f, FVector::UpVector);

// Spin a spawn offset around the actor's up vector each frame
SpawnOffset = SpawnOffset.RotateAngleAxis(RotationSpeed * DeltaTime, GetActorUpVector());

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.