Skip to content

Conversation

NicolasRannou
Copy link
Contributor

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

@mrdoob
Copy link
Owner

mrdoob commented Apr 27, 2016

@WestLangley looks good?

if ( SELECTED ) {

var intersects = raycaster.intersectObject( plane );
var intersection = plane.intersectRay(raycaster.ray);
Copy link
Collaborator

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.

@WestLangley
Copy link
Collaborator

@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?

@NicolasRannou
Copy link
Contributor Author

Thanks for the feed back, I'll address the issues and come back to you!

@NicolasRannou
Copy link
Contributor Author

here you go!

For the math, I described the logic there:
https://github.com/FNNDSC/ami/blob/master/src/core/core.intersections.js#L263-L289
(I am currently writing a JS library to bring medical imaging to the web thanks to THREEJS and its shaders materials [1] [2] - the example page will look familiar... :) )

cc: @WestLangley @mrdoob

[1](Volume Reslicing)[http://fnndsc.github.io/ami/#geometries_slice]
[2](Volume Rendering)[http://fnndsc.github.io/ami/#vr_singlepass_raycasting]

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 28, 2016

What about Ray .intersectsPlane. Isn't it better to have just one method for intersection test of two entities?

@NicolasRannou Why don't you do this in your code?

raycaster.ray.intersectsPlane( plane );

In this case, you don't need Plane . intersectRay.

@NicolasRannou
Copy link
Contributor Author

wow I missed this thanks @Mugen87 !

@NicolasRannou
Copy link
Contributor Author

I create a new pull request to replace this one:
#8758

@mrdoob mrdoob closed this Apr 29, 2016
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

Successfully merging this pull request may close these issues.

4 participants