#include "body.h"
#include "body_list.h"
#include "collision.h"
#include "gapi.h"
#include "position.h"
#include "system.h"
#include <math.h>
Go to the source code of this file.
|
| void | gm_collision_resolve (gmCollision *collision) |
| | Resolves a collision between two bodies by applying appropriate forces and corrections.
|
| void | gm_system_update_body_dt (gmSystem *sys, gmBody *body, double dt) |
| | Updates a single body in the system by integrating its position and velocity over time.
|
| void | gm_body_update_dt (gmBody *body, double dt) |
| | Updates a single body by integrating its position and velocity over time.
|
| void | gm_body_update (gmBody *body) |
| | Updates a single body by integrating its position and velocity over time.
|
| gmCollision * | gm_collision_detect (gmBody *, gmBody *) |
| | Detects collision between two bodies.
|
| void | gm_system_update_dt (gmSystem *sys, double unit, double dt) |
| | Updates the physics system with collision detection at specified time intervals.
|
| int | gm_system_get_collision (gmCollision *collision, gmSystem *sys, gmBody *a, gmBody *b) |
| | Gets the collision information for two specific bodies in a system.
|
| double | gm_collision_penetration_normals (gmBody *a, gmBody *b, double *normal_x, double *normal_y) |
| | Calculates the penetration depth and normal vector for a collision between two bodies.
|
| double | gm_collision_penetration (gmBody *a, gmBody *b) |
| | Calculates the penetration depth for a collision between two bodies.
|
◆ gm_body_update()
| void gm_body_update |
( |
gmBody * | body | ) |
|
Updates a single body by integrating its position and velocity over time.
- Parameters
-
| body | Pointer to the body to update. |
◆ gm_body_update_dt()
| void gm_body_update_dt |
( |
gmBody * | body, |
|
|
double | dt ) |
Updates a single body by integrating its position and velocity over time.
- Parameters
-
| body | Pointer to the body to update. |
| dt | The time step for the update. |
◆ gm_collision_detect()
Detects collision between two bodies.
- Parameters
-
| a | Pointer to the first body. |
| b | Pointer to the second body. |
- Returns
- A pointer to a gmCollision structure if collision occurs, NULL otherwise.
◆ gm_collision_penetration()
Calculates the penetration depth for a collision between two bodies.
- Parameters
-
| a | Pointer to the first body. |
| b | Pointer to the second body. |
- Returns
- The penetration depth between the bodies.
◆ gm_collision_penetration_normals()
| double gm_collision_penetration_normals |
( |
gmBody * | a, |
|
|
gmBody * | b, |
|
|
double * | normal_x, |
|
|
double * | normal_y ) |
Calculates the penetration depth and normal vector for a collision between two bodies.
- Parameters
-
| a | Pointer to the first body. |
| b | Pointer to the second body. |
| normal_x | Pointer to store the x component of the collision normal (can be NULL). |
| normal_y | Pointer to store the y component of the collision normal (can be NULL). |
- Returns
- The penetration depth between the bodies.
◆ gm_collision_resolve()
Resolves a collision between two bodies by applying appropriate forces and corrections.
Resolves a collision by adjusting positions and velocities of colliding bodies.
- Parameters
-
| collision | Pointer to the collision to resolve. |
| coll | Pointer to the collision to resolve. |
◆ gm_system_get_collision()
Gets the collision information for two specific bodies in a system.
- Parameters
-
| collision | Pointer to the collision where to copy the result, or NULL. |
| sys | Pointer to the system to search in. |
| a | Pointer to the first body. |
| b | Pointer to the second body. |
- Returns
- 1 if it found a collision else 0.
◆ gm_system_update_body_dt()
| void gm_system_update_body_dt |
( |
gmSystem * | sys, |
|
|
gmBody * | body, |
|
|
double | dt ) |
Updates a single body in the system by integrating its position and velocity over time.
- Parameters
-
| sys | Pointer to the system containing the body (can be NULL). |
| body | Pointer to the body to update. |
| dt | The time step for the update. |
◆ gm_system_update_dt()
| void gm_system_update_dt |
( |
gmSystem * | sys, |
|
|
double | unit, |
|
|
double | dt ) |
Updates the physics system with collision detection at specified time intervals.
- Parameters
-
| sys | Pointer to the system to update. |
| unit | The time unit for sub-step calculations. |
| dt | The total time step to simulate. |
◆ gm_system_frame_time
| double gm_system_frame_time = 0.001 |
Default time step for physics system frame updates.