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 angle. When using the OBB collision system 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.

Parameters:

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_PASSABLE ignores all passable blocks and entities
IGNORE_PASSENTS ignores passable model and sprite entities
IGNORE_WORLD Ignores all level blocks and terrains.
IGNORE_MAPS ignores all map entities.
IGNORE_MODELS ignores all models.
IGNORE_SPRITES ignores all sprites.
IGNORE_PUSH ignores all entities with lower push values.
USE_AXIS
USE_AXISR
does not 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 Use the old AABB rather than the new ellipsoid collision system. The AABB collision system does not require collision detection on rotation, so the entity is just rotated.

Returns:

>0 - Rotation successful.
0 - Entity was blocked by obstacles and could not be rotated.

Modifies:

entity.pan
entity.tilt
entity.roll
Angles of the entity
normal Normal vector of hit polygon
bounce Bounce vector of hit polygon
in_passable 1 if the rotation ended up in a passable block
in_solid 1 if the rotation ended up in a non passable block
event_type Type of event

Remarks:

Speed:

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

Example:

c_rotate (me, vector(time_step,0,0), IGNORE_YOU);

See also:

c_move, c_trace, c_content, ang_add, collision

► latest version online