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

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -