Jump to content

How to get distance from point to point as integer value(Unigine::Math operation)


photo

Recommended Posts

Hello everyone,

I am looking for a function that calculates distance as an integer value from point(vec3) to point(vec3).I already searched and observed related function from Unigine::Geometry Class but unfortunately i couldn't find any function related to this subject.

https://developer.unigine.com/en/docs/2.6/api/library/math/class.geometry?rlang=cpp#pointTriangleDistance_vec3_vec3_vec3_vec3_vec4_float

Thank you in advance. 

Link to comment

You can substract those two points you have from each other, then get the result vector magnitude - this will give you the distance between those two points in float. Now you can round this value as you want (floor/ceil) and cast to integer.

Edited by arzezniczak
  • Like 2
Link to comment
×
×
  • Create New...