Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
trc_transform.h File Reference

Go to the source code of this file.

Data Structures

struct  trc_transform_t
 

Functions

void move_and_collide (trc_transform_t *transform, const trc_world_position_t velocity)
 
void move_and_slide (trc_transform_t *transform, const trc_world_position_t velocity)
 
void rotate_transform (trc_transform_t *transform, const float rotation_delta)
 

Function Documentation

◆ move_and_collide()

void move_and_collide ( trc_transform_t transform,
const trc_world_position_t  velocity 
)

Moves the given transform in the specified direction, unless there is a wall within a distance equal to the transform's size

If that occurs, the transform will stop moving entirely

The velocity vector specifies both the direction and the speed of the transform

◆ move_and_slide()

void move_and_slide ( trc_transform_t transform,
const trc_world_position_t  velocity 
)

Moves the given transform in the specified direction, unless there is a wall within a distance equal to the transform's size

If that occurs, the transform will slide across the wall (losing velocity according with the collision angle)

The velocity vector specifies both the direction and the speed of the transform

◆ rotate_transform()

void rotate_transform ( trc_transform_t transform,
const float  rotation_delta 
)

Rotates the transform direction in the given signed angle

Note
The direction is determined by the sign of rotation_velocity, if it's positive then the rotation will be anti-clockwise, if it's negative then it'll be clockwise