Origins: Powerful Powers
» Entity actions » Set rotation

Set rotation

origins-powerful-powers:set_rotationentity action

Turns the entity to face a direction.

FieldTypeDefaultDescription
yawFloatnoneLeft/right angle in degrees, the same as the look_yaw attribute: 0 is south, 90 west, 180 north, -90 east. Left out: yaw is kept.
pitchFloatnoneUp/down angle in degrees: -90 straight up, 90 straight down. Left out: pitch is kept.
relativeBooleanfalseWhen true, yaw and pitch are added to the current angles.
max_stepFloatnoneThe most each angle turns in one call, in degrees. Run it from origins:action_over_time to turn smoothly. Left out: it turns all the way at once.
min_stepFloat0A dead zone. When both angles are within this many degrees of the target, the call does nothing.
  • Players: the server sends a teleport that keeps the position and changes only the view. Movement is kept.
  • Mobs: the head and body turn too. Their AI may turn them back on its next tick, so run the action every tick to hold a mob's facing.
  • Other entities (armor stands, projectiles) get the new angles.
  • Cost: for players, each call that changes the view sends a packet, so smooth turning sends one per call. Set min_step (for example 1) to stop calls once the view is close enough. This also avoids camera jitter.

Example: "Compass lock". While sneaking, your view turns north, 10 degrees per tick.

json
{
  "type": "origins:action_over_time",
  "interval": 1,
  "condition": {
    "type": "origins:sneaking"
  },
  "entity_action": {
    "type": "origins-powerful-powers:set_rotation",
    "yaw": 180,
    "pitch": 0,
    "max_step": 10,
    "min_step": 1
  }
}