UKismetMathLibrary::Conv_Vector2DToIntPoint
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Converts a 2D float vector to an integer point by truncating each component. Useful when converting floating-point screen or texture coordinates to pixel indices.
Caveats & Gotchas
- • Conversion truncates (rounds toward zero), not rounds. FVector2D(1.9, 1.9) becomes FIntPoint(1, 1), not (2, 2).
- • No bounds checking is performed — if the float values exceed INT32 limits the result is undefined.
Signature
static UE_INL_API FIntPoint Conv_Vector2DToIntPoint(FVector2D InVector2D); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InVector2D | FVector2D | The 2D vector to convert. | — |
Return Type
FIntPoint Example
Convert mouse position to tile index C++
FVector2D MousePos;
GetMousePosition(MousePos.X, MousePos.Y);
FIntPoint TileIndex = UKismetMathLibrary::Conv_Vector2DToIntPoint(MousePos / TileSize); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?