www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: ginopeloso on October 24, 2014, 05:06:36 pm

Title: Click coordinates in object space
Post by: ginopeloso on October 24, 2014, 05:06:36 pm
I have the following situation: a user clicks on the screen and the app gets the screen coordinates of the click.

With the method
Code: [Select]
Interact2D.reproject2D3D I obtain the coordinates of the click in Camera Space.
With
Code: [Select]
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
Code: [Select]
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!
Title: Re: Click coordinates in object space
Post by: EgonOlsen on October 24, 2014, 05:18:52 pm
Object3D has a method called getInverseWorldTransformation(). Just multiply the vector in world space with the returned matrix and you are back in object space.