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

How to get the arclen between two curve points in Maya? -

C++ Linked List -

git svn - Unignore directories in git-svn (adding directories to a sparse checkout) -