object.face_toward
This function can be used to make one object face toward another. It only affects the object's heading (yaw), not its pitch or roll rotations.
Arguments
- other
The object whose rotation should be copied.
- x
The X-coordinate of an offset-position. The object will rotate to face other's position plus the offset position. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.
- y
The Y-coordinate of an offset-position. The object will rotate to face other's position plus the offset position. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.
- z
The Z-coordinate of an offset-position. The object will rotate to face other's position plus the offset position. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.
Example
global.object[0].copy_rotation_from(global.object[1], true)
Notes
If you face an object toward itself, you can use the position offset to rotate it.