opensourceBIM / BIMsurfer-before2019

This is the repository of the v1 and v2 version of BIM Surfer. It is not maintained anymore. Find the most recent version on https://github.com/opensourceBIM/BIMsurfer
MIT License
432 stars 195 forks source link

how to get world point when i do a custom click? #236

Closed comger closed 6 years ago

comger commented 6 years ago

how to get world point when i do a custom click? like clientToWorld or screenToWorld; and how to project the world point by camera when camera change.

comger commented 6 years ago

var hit = scene.pick({ pickSurface: true, canvasPos: [23, 131] });

if (hit) { // Picked an Entity

 var entity = hit.entity;

 var primitive = hit.primitive; // Type of primitive that was picked, usually "triangles"
 var primIndex = hit.primIndex; // Position of triangle's first index in the picked Entity's Geometry's indices array
 var indices = hit.indices; // UInt32Array containing the triangle's vertex indices
 var localPos = hit.localPos; // Float32Array containing the picked Local-space position on the triangle
 var worldPos = hit.worldPos; // Float32Array containing the picked World-space position on the triangle
 var viewPos = hit.viewPos; // Float32Array containing the picked View-space position on the triangle
 var bary = hit.bary; // Float32Array containing the picked barycentric position within the triangle
 var normal = hit.normal; // Float32Array containing the interpolated normal vector at the picked position on the triangle
 var uv = hit.uv; // Float32Array containing the interpolated UV coordinates at the picked position on the triangle

}