RealDocs

UKismetMathLibrary::Spherical2DToUnitCartesian

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Converts a 2D spherical coordinate (polar + azimuth in radians) to a unit-length 3D Cartesian direction vector on the unit sphere.

Caveats & Gotchas

  • Input angles are in radians, not degrees. Passing degree values will produce a completely wrong direction silently.
  • The input FVector2D is interpreted as (Theta, Phi), mapping to (polar angle from Z axis, azimuthal angle around Z). This convention can differ from other spherical-coordinate systems — verify the axis mapping for your use case.

Signature

static UE_INL_API FVector Spherical2DToUnitCartesian(FVector2D A);

Parameters

Name Type Description Default
A FVector2D Spherical coordinates as (Theta, Phi) in radians where X=Theta (polar/elevation) and Y=Phi (azimuth).

Return Type

FVector

Example

Convert a spherical direction to a world-space ray C++
float Theta = FMath::DegreesToRadians(45.f); // elevation
float Phi   = FMath::DegreesToRadians(90.f); // azimuth
FVector Dir = UKismetMathLibrary::Spherical2DToUnitCartesian(FVector2D(Theta, Phi));

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.