Get 3d coordinates from 2d point
See original GitHub issueHi guys
I would like to know how can i get the 3d coordinates from a collision point mouse 2d from this code
function onDocumentMouseDown( event ) {
event.preventDefault();
mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
mouse2d.z = 1;
var r = new THREE.Ray();
r.origin.copy( mouse2d );
var matrix = camera.matrixWorld.clone();
matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix ) );
matrix.multiplyVector3( r.origin );
r.direction = r.origin.clone().subSelf( camera.position );
var c = THREE.Collisions.rayCastNearest( r );
if( c ) {
//////////////////HERE GET THE 3D POINT COORDINATES////////////////////////
c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
} else {
plane.materials[0].color.setHex( 0xF9EFD7 );
}
};
The collision object is a plane which i use as ground and i want to know the collision point 3d coords in order to set an object’s position. Thanks in advance
Issue Analytics
- State:
- Created 12 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to get 3D point coordinates from a 2D point? - Reddit
Use cv2.recoverPose to get the triangulated 3d points. You can refer to the OpenCV docs, go to the cv2.recoverpose section.
Read more >Computing the Pixel Coordinates of a 3D Point (Mathematics ...
Note that pixels too are 2D points, only their coordinates are integers and the coordinate system these coordinates refer to is located in...
Read more >How do I reverse-project 2D points into 3D? - Stack Overflow
Projecting each of these 3D coordinates into 2D is done by multiplying the 4D vector [x, y, z, 1] with a 4x4 projection...
Read more >3d coordinate from 2d pixel coordinate · Issue #3 - GitHub
I tried calculating the 3d world coordinates from 2d pixel coordinates using the estimated homography using the provided code. Here is the small ......
Read more >How can I convert 3D world coordinates to 2D image ...
The ZED SDK provides also the point cloud, providing 3D and RGB information for each pixel (u,v). What are the formulas to get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Never mind found it