Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Functions
collider.cpp File Reference
#include "server/game/collider.hpp"
#include "server/game/object.hpp"

Functions

bool detectCollision (const Physics &obj1, const Physics &obj2)
 Detects whether a collision has occurred between two objects given their Physics structs; this is done by checking for overlap between the two object's surfaces (defined by their positions + dimensions + collider shape) More...
 
bool detectCollisionSphere (const Physics &sphere, const Physics &obj)
 Detects whether a collision has occurred between two objects given their Physics structs and that the first object is a sphere. More...
 
bool detectCollisionBox (const Physics &box, const Physics &obj)
 Detects whether a collision has occurred between two objects given their Physics structs and that the first object is a box. More...
 

Function Documentation

◆ detectCollision()

bool detectCollision ( const Physics obj1,
const Physics obj2 
)

Detects whether a collision has occurred between two objects given their Physics structs; this is done by checking for overlap between the two object's surfaces (defined by their positions + dimensions + collider shape)

Parameters
obj1Reference to the first object's Physics struct.
obj2Reference to the second object's Physics struct.
Returns
true if a collision (overlap) is detected between the two objects' surfaces, and false otherwise.

◆ detectCollisionBox()

bool detectCollisionBox ( const Physics box,
const Physics obj 
)

Detects whether a collision has occurred between two objects given their Physics structs and that the first object is a box.

Parameters
boxReference to the box object's Physics struct.
objReference to the second object's Physics struct.
Returns
true if a collision is detected between the box and the second object, and false otherwise.

◆ detectCollisionSphere()

bool detectCollisionSphere ( const Physics sphere,
const Physics obj 
)

Detects whether a collision has occurred between two objects given their Physics structs and that the first object is a sphere.

Parameters
sphereReference to the sphere object's Physics struct.
objReference to the second object's Physics struct.
Returns
true if a collision is detected between the sphere and the second object, and false otherwise.