Author Topic: Click coordinates in object space  (Read 1554 times)

Offline ginopeloso

  • byte
  • *
  • Posts: 13
    • View Profile
Click coordinates in object space
« 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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Click coordinates in object space
« Reply #1 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.