Difference between revisions of "API Panel.Position.RotateTo"
(XML import) |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | Rotates the object to the given rotation | + | |- |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateTo''' | ||
+ | |- | ||
+ | | colspan="2" | Rotates the object to the given rotation | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" | Handle | ||
+ | |- | ||
+ | | colspan="2" | The position or component to update | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" | Pivot | ||
+ | |- | ||
+ | | colspan="2" | The coordinates of the rotation center, Handle if zero | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" | Axis | ||
+ | |- | ||
+ | | colspan="2" | An axis to align the angles to, Handle if zero | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | X_Pitch | ||
+ | |- | ||
+ | | colspan="2" | The absolute local X degrees to update with | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Y_Yaw | ||
+ | |- | ||
+ | | colspan="2" | The absolute local Y degrees to update with | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Z_Roll | ||
+ | |- | ||
+ | | colspan="2" | The absolute local Z degrees to update with | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - NONE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | + | ==Detailed description== |
− | + | This rotates an object to the exact orientation specified. The orientation is represented as [[Object Rotation|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 [[API Panel.Position.RotateAlong|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 [[API Panel.Position.Get|Get]] and the orientation restored using [[API Panel.Position.SetRotation|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== | ==Examples== | ||
===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)