float distance = sqrt(v.x*v.x + v.y*v.y + v.z*v.z); v.x = v.x/distance; v.y = v.y/distance; v.z = v.z/distance;