1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add basic unit tests for collisionMoveSimple

This commit is contained in:
sfan5 2024-11-05 19:14:44 +01:00
parent 1c92d6243f
commit f916f5de78
4 changed files with 139 additions and 2 deletions

View file

@ -37,6 +37,8 @@ struct CollisionInfo
v3f new_pos;
v3f old_speed;
v3f new_speed;
// FIXME: this is equivalent to `axis`, why does it exist?
int plane = -1;
};
@ -44,12 +46,16 @@ struct collisionMoveResult
{
collisionMoveResult() = default;
bool touching_ground = false;
bool collides = false;
bool touching_ground = false;
bool standing_on_object = false;
std::vector<CollisionInfo> collisions;
};
/// Status if any problems were ever encountered during collision detection.
/// @warning For unit test use only.
extern bool g_collision_problems_encountered;
/// @brief Moves using a single iteration; speed should not exceed pos_max_d/dtime
/// @param self (optional) ActiveObject to ignore in the collision detection.
collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,