c# - finding points along a vector in 3d -


i have 2 points in 3d space, , want list of points between them located "r" distance each other. how can using unity functions? enter image description here

vector3[] getpointsinbetween(vector3 a, vector3 b, float offset){     int count = (int)((b - a).magnitude / offset);     vector3[] result = new vector3[count];      vector3 delta = (b - a).normalized * offset;      (int = 0; < count; i++) {         result[i] = + delta * i;         debug.log(result[i]);     }      return result; } 

but .magnitude , .normalized expensive operations, try avoid using in update()


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -