Hey
I'm currently programming with JavaScript(not Java) and Three.js but my problem is not related to which language I use but some XYZ cordinate math which isn't one of my strong points.
I am trying to draw a line from camera.position to mouse click and it works fine, I just cannot figure out how to move the end location further away.
1 2 3 4 5 6
| var geometry = new THREE.Geometry(); geometry.vertices.push( camera.position ); geometry.vertices.push( new THREE.Vector3( vector.x, vector.y, vector.z ) ); var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x0000FF, opacity: 1 } ) ); |
This piece of code does work but the line itself it extremely short, I have tried to multiply every value by 2 but that only works in some directions, if I move the camera to another direction the line is pointing the wrong direction and not towards my click, so I think my cordinate math is way off.
My end goal is to do raycast with the mouse click, sometimes the ray does hit something and sometimes it does not, so I'm trying to debug it by displaying a line.