c_rotate(ENTITY* entity, ANGLE* angle, var mode)

Performs a collision detection of the given entity against its environment while rotating it by the given Euler angles. When the entity has a non-symmetrical collision shape and obstacles are nearby, use this function to rotate an entity rather than directly modifying its angles. Otherwise the entity could end up within another object on rotation.


entity Entity to be rotated
angle Rotation angle
mode Collision and rotation mode, see below.

The following mode combinations are available:

IGNORE_YOU Ignores the you entity on collision detection.
IGNORE_FLAG2 A7.73 Ignores all entities with FLAG2 set.
IGNORE_PASSABLE Ignores all passable blocks and entities
IGNORE_PASSENTS Ignores passable model and sprite entities
IGNORE_WORLD Ignores all level blocks and terrains (useful for doors).
IGNORE_MAPS Ignores all map entities.
IGNORE_MODELS Ignores all models.
IGNORE_SPRITES Ignores all sprites.
IGNORE_PUSH Ignores all entities with a lower push or same group value than the given entity. For ignoring certain entity groups, call c_ignore before c_rotate.
GLIDE Attempts to displace the entity origin when hitting an obstacle, in a way that the rotation can still be performed. Useful for rotating a nonsymmetrical actor.
Doesn't rotate about world coordinates, but about the entities' coordinate system. USE_AXIS rotates the entity angle by the angle parameter (like ang_add), USE_AXISR rotates the angle parameter by the entity angle (like ang_rotate). This is required for rotating an arbitrarily orientated object, like an airplane or a spaceship, with collision detection. See ang_add for details.
USE_AABB Rotates the entity without any collision detection.


 > 0 - Rotation successful.
<= 0 - Entity could not be rotated, f.i. due to obstacles.


entity.pan, tilt, roll Entity angles
entity.x, y, z Entity position (when GLIDE is enabled) .
normal Normal vector of hit polygon
bounce Bounce vector of hit polygon
event_type Type of triggered event



Fast if USE_AABB is set and USE_AXIS / USE_AXISR is not set; otherwise slow.

Example (lite-C):

action door()
  while (1)
    if (key_space && my.pan < 180)  

See also:

c_move, c_trace, c_scan, c_ignore, ang_add, collision

► latest version online