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

Raycast Picker issue #14

Open
tilak2017 opened this issue Nov 15, 2017 · 5 comments
Open

Raycast Picker issue #14

tilak2017 opened this issue Nov 15, 2017 · 5 comments

Comments

@tilak2017
Copy link

tilak2017 commented Nov 15, 2017

I am using awayjs lib to render complex 3D models. I have assigned mouse click event for 3d model meshes using Raycaspicker(false).
Raycast Picker is not picking meshes correctly, its not returning the first collision encountered.

@tilak2017 tilak2017 changed the title Raycast Picke issue Raycast Picker issue Nov 15, 2017
@rob-bateman
Copy link
Member

If you require the closest collision to be returned, you should be using Raycaspicker(true).

@tilak2017
Copy link
Author

tilak2017 commented Jan 22, 2018 via email

@tilak2017
Copy link
Author

tilak2017 commented Feb 19, 2018 via email

@rob-bateman
Copy link
Member

Something else you can try is to define a PickingCollider object on the meshes you are trying to detect

by default, picking will only detect against bounding boxes which may be why you're still getting the wrong mesh ie the bounding box of the front-left mesh encloses the bounding box of the front-strap. if you want to do per-triangle picking, you need to set a PickingCollider object on the meshes. You can do this by listening for Mesh objects on ASSET_COMPLETE and adding a new JSPickingCollider object by doing the following:

view.setCollider(mesh, new JSPickingCollider(true));

I realise this system is currently a little unwieldy - if you can't get it to work then you should check out the mouse interaction example source here that implements the same code above:

https://github.com/awayjs/awayjs-examples/blob/dev/src/Intermediate_MouseInteraction.ts

hth

@tilak2017
Copy link
Author

tilak2017 commented Mar 2, 2018 via email

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

No branches or pull requests

2 participants