Difference between revisions of "API Panel.Position.RotateTo"
Line 61: | Line 61: | ||
===Calling in a calculation=== | ===Calling in a calculation=== | ||
* Add to a calculation icon: <pre class="brush:[cpp]">::Panel.Position.RotateTo(handle, pivot, axis, x_pitch, y_yaw, z_roll)</pre> | * Add to a calculation icon: <pre class="brush:[cpp]">::Panel.Position.RotateTo(handle, pivot, axis, x_pitch, y_yaw, z_roll)</pre> | ||
− | |||
− |
Latest revision as of 11:54, 16 January 2023
Detailed description
This rotates an object to the exact orientation specified. The orientation is represented as Euler angles. This is typically useful for setting to an exact angle, but is not recommended for incremental changes - Euler angles suffer from gimbal lock and it can be difficult to maintain an absolute values through incremental changes.
For an incremental change, use RotateAlong.
If Pivot or Axis are zero, that parameter is ignored. This is in contrast with most Position calls that treat zero as world-space. It is advised not to use world-space in a component that is exported, use this as the coordinate space instead.
Note that a common mistake is to set the orientation to (0, 0, 0) to reset the Handle back to its original position. Where as this will work for objects that are originally aligned to the specified axis, this will not work for objects whose initial position is off axis. To reliably restore the orientation of an object, the original position should be read and stored with a call to Get and the orientation restored using SetRotation.
Note another common mistake is to set the angle relative to the object being rotated. Specifying the same Axis as Handle will cause the object to be rotated relative to itself, which may have unexpected results.
Examples
Calling in a calculation
- Add to a calculation icon:
::Panel.Position.RotateTo(handle, pivot, axis, x_pitch, y_yaw, z_roll)