Saga
Saga Game Engine
Loading...
Searching...
No Matches
Saga::Systems::anonymous_namespace{collisionSystem.cpp} Namespace Reference

Functions

glm::vec3 detectCollision (CylinderCollider &a, Transform &aTransform, CylinderCollider &b, Transform &bTransform)
 Detect collision between two axis-aligned cylinder colliders, and return the mtv such that if the first cylinder is translated by the mtv, the two objects no longer collide.
 
std::pair< glm::vec3, std::vector< Collision > > ellipsoidTriangleCollisions (std::shared_ptr< GameWorld > world, Entity entityEllipsoid, Transform &transform, EllipsoidCollider &ellipsoidCollider, RigidBody &rigidBody, glm::vec3 move)
 Handle collisions between a moving ellipsoid and triangles in the scene. By default, this does 100 translations before dropping further movement.
 
void cylinderCylinderCollision (std::shared_ptr< GameWorld > world, float deltaTime, float time)
 Process all cylinder-cylinder collisions. If two cylinders penetrate, they move by half of the minimum translation vector away from each other if they are both dynamic. Otherwise, only the dynamic one move and moves by the full mtv, plus some epsilon. By default, this only resolve 100 collisions per call.
 

Function Documentation

◆ cylinderCylinderCollision()

void Saga::Systems::anonymous_namespace{collisionSystem.cpp}::cylinderCylinderCollision ( std::shared_ptr< GameWorld world,
float  deltaTime,
float  time 
)

Process all cylinder-cylinder collisions. If two cylinders penetrate, they move by half of the minimum translation vector away from each other if they are both dynamic. Otherwise, only the dynamic one move and moves by the full mtv, plus some epsilon. By default, this only resolve 100 collisions per call.

Parameters
world
deltaTime
timetime ellapsed since the start of the program.
Here is the call graph for this function:

◆ detectCollision()

glm::vec3 Saga::Systems::anonymous_namespace{collisionSystem.cpp}::detectCollision ( CylinderCollider a,
Transform aTransform,
CylinderCollider b,
Transform bTransform 
)

Detect collision between two axis-aligned cylinder colliders, and return the mtv such that if the first cylinder is translated by the mtv, the two objects no longer collide.

Parameters
athe first cylinder collider.
aTransformthe first cylinder transform, used to position the cylinder in space.
bthe second cylinder collider.
bTransformthe second cylinder transform, used to position the cylinder in space.
Returns
glm::vec3 zero if the two cylinders are not colliding. Otherwise the mtv.
Here is the call graph for this function:

◆ ellipsoidTriangleCollisions()

std::pair< glm::vec3, std::vector< Collision > > Saga::Systems::anonymous_namespace{collisionSystem.cpp}::ellipsoidTriangleCollisions ( std::shared_ptr< GameWorld world,
Entity  entityEllipsoid,
Transform transform,
EllipsoidCollider ellipsoidCollider,
RigidBody rigidBody,
glm::vec3  move 
)

Handle collisions between a moving ellipsoid and triangles in the scene. By default, this does 100 translations before dropping further movement.

Parameters
world
entityEllipsoidentity the ellipsoid is attached to.
transformthe entity's transform.
ellipsoidColliderthe entity's ellipsoid collider.
rigidBodythe entity's rigid body.
deltaTimetime since last update call, in seconds.
Returns
std::pair<glm::vec3, std::vector<Collision>> pair containing the ending position of the ellipsoid, as well as a list of all collisions that the ellipsoid triggered while moving.
Here is the call graph for this function: