This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 4rpl:commands:rotateunittowardscell [2022/12/04 23:19] – [Examples] Removed extra parentheses Vertu | 4rpl:commands:rotateunittowardscell [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ===== Description ===== | ===== Description ===== | ||
| - | Rotates a unit so that its forward, or positive Z axis, points towards the supplied position, but with rotation confined to the plane of the map (the XZ plane). | + | Rotates a unit so that its forward, or positive Z axis, points towards the supplied position, but with rotation confined to the plane of the map (the XZ plane).\\ |
| - | The X, Z coordinates are a position in the plane of the map. | + | The X, Z coordinates are a position in the plane of the map.\\ |
| - | The max rotation can be limited by supplying a maxRotationDeg in degrees. | + | The max rotation can be limited by supplying a maxRotationDeg in degrees.\\ |
| - | If a negative value is specified for the maxRotationDeg, | + | If a negative value is specified for the maxRotationDeg, |
| + | |||
| + | :WARNING: This API will attempt to set the X and Z rotation vectors to 0 at all times. See [[4rpl: | ||
| + | If using objects is undesirable, | ||
| + | Or for a simpler solution: ensure that the rotation from this API is weaker than other uses of RotateUnit. | ||
| ===== Examples ===== | ===== Examples ===== | ||
| <code 4rpl> | <code 4rpl> | ||
| RotateUnitTowardsCell(< | RotateUnitTowardsCell(< | ||
| + | </ | ||
| + | <code 4rpl> | ||
| + | GetUnitRotation(self) ->curRot | ||
| + | RotateUnit(self V3(-25 < | ||
| + | RotateUnitTowardsCell(self < | ||
| </ | </ | ||
| < | < | ||