Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i get mouse point use vertex_data ? #359

Open
liangfz-kit opened this issue Sep 11, 2020 · 2 comments
Open

How do i get mouse point use vertex_data ? #359

liangfz-kit opened this issue Sep 11, 2020 · 2 comments
Assignees
Labels

Comments

@liangfz-kit
Copy link

liangfz-kit commented Sep 11, 2020

I use viewer.pick(x, y) get vertex_data in SurfaceView, when i have vertex_data, then SurfaceView zoom, How can i get x, y?

@natacha-beck natacha-beck self-assigned this Sep 28, 2020
@natacha-beck
Copy link
Contributor

natacha-beck commented Sep 28, 2020

Hi @liangfz-kit ,

I'm not 100% sure about what you are looking for. But I think that should be helpful:

var pick_info = viewer.pick();
console.log(pick_info.point.x);
console.log(pick_info.point.y);

@liangfz-kit
Copy link
Author

    var p = new THREE.Vector3(x, y, z);
    p = p.applyMatrix4(viewer.model.matrixWorld);
    var vector = p.project(camera);
    var x = (vector.x + 1) / 2 * viewer.dom_element.offsetWidth;
    var y = -(vector.y - 1) / 2 * viewer.dom_element.offsetHeight;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants