Rotating 3D Objects to face a Target
in
Processing with Other Languages
•
2 years ago
Hey Guys
I am kind of stuck I am trying to get a 3d rectangle to rotate in order to face a specific x, y, z coordinate. (Note: This x, y and z coordinate changes as the simulation runs)
I have already looked at http://www.andrewnoske.com/wiki/index.php?title=Computer_graphics_-_common_problems which shows how to calculate the necessary rotation in order for the 3d object to face a target but this is using C++ where an object is rotate around its centre.
In processing this is not the case as using rotateX() . . rotates the whole grid. So my question is:
I have already looked at http://www.andrewnoske.com/wiki/index.php?title=Computer_graphics_-_common_problems which shows how to calculate the necessary rotation in order for the 3d object to face a target but this is using C++ where an object is rotate around its centre.
In processing this is not the case as using rotateX() . . rotates the whole grid. So my question is:
Is there a simply way to rotate an object to a specific direction given the coordinates of another target object?
or
Is there some way to adapt the above values from the link which are used to rotate an object around its centre so that they can work in processing where the rotation changes the whole grid.
Sadly my math is not what it used to be.
or
Is there some way to adapt the above values from the link which are used to rotate an object around its centre so that they can work in processing where the rotation changes the whole grid.
Sadly my math is not what it used to be.
Any help would be appreciated.
Thanks!
2