javascript - Get direction between two 3d vectors using Three.js? -


i have 2 points:

v1 = (0, 0, 0); v2 = (10, 4, -3); 

i want direction between these 2 points can raycast point v1 v2.

how do that?

the pattern follow create direction vector v1 v2 this:

var dir = new three.vector3(); // create once reuse  ...  dir.subvectors( v2, v1 ).normalize(); 

direction vectors in three.js assumed have unit-length. in other words, must normalized. if direction vector use when raycasting not have length equal 1, not accurate results.

three.js r.82


Comments

Popular posts from this blog

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -