Skip to content

How do i get mouse point use vertex_data ? #359

Open

Description

@liangfz-kit

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?

Activity

  1. self-assigned this
    on Sep 28, 2020
  2. natacha-beck commented on Sep 28, 2020

    @natacha-beck
    Contributor

    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);
  3. liangfz-kit commented on Oct 19, 2020

    @liangfz-kit
    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions