User Tools

Site Tools


4rpl:commands:rotateunittowardscell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:commands:rotateunittowardscell [2021/01/08 16:01] – created - external edit 127.0.0.14rpl: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, the rotation will move away from rather than towards the specified target location+If a negative value is specified for the maxRotationDeg, the rotation will move away from rather than towards the specified target location
 + 
 +:WARNING: This API will attempt to set the X and Z rotation vectors to 0 at all times. See [[4rpl:commands:rotateobjtowardscell|RotateObjTowardsCell]] for an API that only modifies the Y vector.\\ 
 +If using objects is undesirable, you can opt to use [[4rpl:commands:rotateunit|RotateUnit]] and handle the rotation process yourself.\\ 
 +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(<-UID42 23 1)+RotateUnitTowardsCell(<-UID 42 23 1
 +</code> 
 +<code 4rpl> 
 +GetUnitRotation(self) ->curRot 
 +RotateUnit(self V3(-25 <-curRot.y <-curRot.z) <-TURN_SPEED 0.1 +) #--Ensure this is stronger than TowardsCell 
 +RotateUnitTowardsCell(self <-destination.x <-destination.z <-TURN_SPEED)
 </code> </code>
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/rotateunittowardscell.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)