RealDocs

UKismetMathLibrary::Conv_Vector2DToVector

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

Description

Converts a 2D vector to a 3D vector by appending a Z component. Use this when you need to pass a UI or screen-space coordinate into a world-space vector API.

Caveats & Gotchas

  • The Z parameter defaults to 0, producing a flat XY-plane vector. If you're converting to a world direction, you'll almost certainly need to set Z explicitly.
  • In Blueprint this node appears as 'To Vector (Vector2D)' and is auto-cast when a Vector2D pin connects to a Vector input.

Signature

static UE_INL_API FVector Conv_Vector2DToVector(FVector2D InVector2D, float Z = 0);

Parameters

Name Type Description Default
InVector2D FVector2D The 2D vector to convert.
Z float The Z component to use for the resulting 3D vector. 0

Return Type

FVector

Example

Convert screen offset to world-space translation vector C++
FVector2D ScreenOffset(100.f, 200.f);
FVector WorldOffset = UKismetMathLibrary::Conv_Vector2DToVector(ScreenOffset, 0.f);
// WorldOffset = (100, 200, 0)

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.