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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -