A_RotateSpikeBall is an action that alters the location and angle of an Object relative to its target. By calling the action continuously, it can be used to rotate Objects around their targets. It got its name from the spike balls that formerly could be enabled to rotate around the Egg Mobile in versions preceding v2.1.
A_RotateSpikeBall moves the actor around its target by a specific distance on a circular path. It does that by adding to the actor's angle and then setting its location to that of its target, but displaced by a fixed distance in the direction of the actor's new angle. That means that after moving, the Object always faces straight away from the target (unless the value of the displacement is negative). The distance to the target is a fixed value which stays the same between uses.
For example, if the angle is 90° (which is to the west of the target), the Object would be placed to the west of the target with a specific distance. Then, if the angle is changed to 45°, the Object would be placed to the northwest of the target, but with the same distance to the target as before. Because the distance always stays the same, it forms a circular path around the target. This means that if the action is called continuously (normally every tic), it rotates the actor smoothly around the target.
Both the distance to the target and the angle increment/revolution speed are determined by the actor's
Speed value from its properties. The angle of the target has no impact on the angle of the actor. Because both values are set from the same property, there is a fixed angle increment for every rotation radius. Because the angle of the actor determines where it is in the rotation, anything that changes the angle of the actor will likewise change its position in the rotation once
A_RotateSpikeball is called.
When the target moves, the actor will lag behind (both vertically and horizontally), similar to the camera when the player is moving fast. This effect does not change with the actor's
For the normal behavior above Var1 is usually set to 0; however, when set to anything else the actor will follow the tracer object instead of the target object as it usually would.
When determining what
Speed value to use for this action, the following rules determine the properties of the resulting rotation:
|Duration of a full revolution||Tics||360 × |
|Displacement/Radius from target||Fracunits||12 × |
Speed value is positive, the actor faces away from the target and rotates counter-clockwise. If the
Speed value is negative, this causes both the displacement and the angle increment to be negative; this is why it rotates clockwise and faces towards the target instead of away.
The titular example of use, the proto-CEZ3 spike ball has a
Speed value of
10*FRACUNIT (10 fracunits per tic), resulting in a radius of 120 fracunits, a revolution time of 36 tics, a starting angle of 280° and an apparent movement speed of 20 fracunits per tic.
Some additional results from different
Speed entries can be seen below:
||Displacement/Radius||Revolution time||Angle increment|
||120 fracunits||36 tics||10°|
||24 fracunits||180 tics||2°|
||12 fracunits||360 tics||1°|
||~1 fracunit||~4320 tics||~0,08°|
||-12 fracunits||360 tics||-1°|
||-120 fracunits||36 tics||-10°|
|Actions – Rotational movement||[view]|
|A_Custom3DRotate • A_OrbitNights • A_RotateSpikeBall • A_SparkFollow • A_UnidusBall|