Click coordinates in object space

Started by ginopeloso, October 24, 2014, 05:06:36 PM

Previous topic - Next topic

ginopeloso

I have the following situation: a user clicks on the screen and the app gets the screen coordinates of the click.

With the method Interact2D.reproject2D3D I obtain the coordinates of the click in Camera Space.
With Interact2D.reproject2D3DWS I obtain the coordinates in World Space. How can I obtain the same coordinates in Object Space?

I need to change the X and the Y of the rotation pivot of the object in the point of the object where the user clicks. As the doc says the method Object3D.setRotationPivot sets the rotation pivot of the object. The rotation pivot is the point in objectspace around which the object will be rotated using its rotation matrix.

Thanks!

EgonOlsen

Object3D has a method called getInverseWorldTransformation(). Just multiply the vector in world space with the returned matrix and you are back in object space.