1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Improve axisAlignedCollision documentation

This commit is contained in:
Josiah VanderZee 2024-11-12 07:43:13 -06:00
parent ab7b1af0fd
commit 702e7dda90
No known key found for this signature in database
GPG key ID: C7BB8573A4ABC4B9

View file

@ -70,10 +70,19 @@ bool collision_check_intersection(Environment *env, IGameDef *gamedef,
const aabb3f &box_0, const v3f &pos_f, ActiveObject *self = nullptr,
bool collide_with_objects = true);
// Helper function:
// Checks for collision of a moving aabbox with a static aabbox
// Returns -1 if no collision, 0 if X collision, 1 if Y collision, 2 if Z collision
// dtime receives time until first collision, invalid if -1 is returned
/**
* Helper function to check for collision of a moving aabbox with a static one.
*
* @param staticbox A stationary hitbox.
* @param movingbox A moving hitbox.
* @param speed The velocity of the moving hitbox.
* @param dtime Only collisions that occur within @dtime will be
* searched.
*
* @return Returns -1 if no collision, 0 if X collision, 1 if Y collision,
* 2 if Z collision. Sets @a dtime to the time until the first collision,
* or to -1 if no collision occurs.
*/
CollisionAxis axisAlignedCollision(
const aabb3f &staticbox, const aabb3f &movingbox,
v3f speed, f32 *dtime);