-
-
Notifications
You must be signed in to change notification settings - Fork 36k
compute reference plane on the fly for draggable cube example #8733
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
Conversation
(vs intersection point and raycaster position)
…ee.js into draggableCubes
(not in the plane defined by normal: object.position and camera.position)
@WestLangley looks good? |
if ( SELECTED ) { | ||
|
||
var intersects = raycaster.intersectObject( plane ); | ||
var intersection = plane.intersectRay(raycaster.ray); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make use of the optionalTarget
to avoid instantiating Vector3
's unnecessarily.
@NicolasRannou The use of a theoretical plane instead of a geometric one is a good idea. : - ) The cubes "jump" when you start to drag them. Compare with the smooth action of the current version. I will not be able to check the math in at timely fashion. /ping @Mugen87 for some help with the rewrite? |
Thanks for the feed back, I'll address the issues and come back to you! |
here you go! For the math, I described the logic there: cc: @WestLangley @mrdoob [1](Volume Reslicing)[http://fnndsc.github.io/ami/#geometries_slice] |
What about @NicolasRannou Why don't you do this in your code? raycaster.ray.intersectsPlane( plane ); In this case, you don't need |
wow I missed this thanks @Mugen87 ! |
I create a new pull request to replace this one: |
Do not rely on pre-comupted plane for dragging cubes because if we zoom out too much, the reference plane used for dragging gets too small and dragging stops working.
http://threejs.org/examples/#webgl_interactive_draggablecubes
See #8727