Hello,
I want to rotate a shape (a mesh) from API (Zmq), just like the option provided by the Rotation tab in the Orientation dialogue in Coppeliasim. So I want to simply rotate the object around the z-axis for some value ( z-axis of world frame, but not around the world as the center ).
Cheers,
Rotate an object from API
Re: Rotate an object from API
Code: Select all
eulerAngles = sim.getObjectOrientation(shapeHandle, sim.handle_world)
eulerAngles[3] = eulerAngles[3] + amount
sim.setObjectOrientation(shapeHandle, eulerAngles, sim.handle_world)
sim.handle_world
is the default, so it is not required to specify it;- objects rotate around their origin. Arbitrary rotation centers can be obtained by temporarily reparenting to another object, e.g. a temporary dummy placed in the desired location of the rotation center, or the object reference frame can be changed (see the "relocate shape reference frame" family of functions).
-
- Posts: 25
- Joined: 11 Sep 2022, 06:48
Re: Rotate an object from API
Thank you. I am familiar with sim.SetObjectOrientation functionality. However, the alpha, beta, omega values that you wish to pass to the function do not work as you defined it, since the object's frame is oriented relative to the world frame, and it's not a general answer to this problem. However, I changed my scene in order to make such a definition work.
Re: Rotate an object from API
Then you want to specify the frame relative to something else than
Simply change that parameter when calling sim.setObjectOrientation
sim.handle_world
.Simply change that parameter when calling sim.setObjectOrientation
Re: Rotate an object from API
Have also a look at sim.rotateAroundAxis
Cheers
Cheers
-
- Posts: 25
- Joined: 11 Sep 2022, 06:48