#include "collision.h"#include <cmath>#include "mapblock.h"#include "map.h"#include "nodedef.h"#include "gamedef.h"#include "serverenvironment.h"#include "server/serveractiveobject.h"#include "util/timetaker.h"#include "profiler.h"
Include dependency graph for collision.cpp:Macros | |
| #define | PROFILER_NAME(text) (dynamic_cast<ServerEnvironment*>(env) ? ("Server: " text) : ("Client: " text)) |
Functions | |
| CollisionAxis | axisAlignedCollision (const aabb3f &staticbox, const aabb3f &movingbox, const v3f speed, f32 *dtime) |
| bool | wouldCollideWithCeiling (const std::vector< NearbyCollisionInfo > &cinfo, const aabb3f &movingbox, f32 y_increase, f32 d) |
| static bool | add_area_node_boxes (const v3s16 min, const v3s16 max, IGameDef *gamedef, Environment *env, std::vector< NearbyCollisionInfo > &cinfo) |
| static void | add_object_boxes (Environment *env, const aabb3f &box_0, f32 dtime, const v3f pos_f, const v3f speed_f, ActiveObject *self, std::vector< NearbyCollisionInfo > &cinfo) |
| collisionMoveResult | collisionMoveSimple (Environment *env, IGameDef *gamedef, const aabb3f &box_0, f32 stepheight, f32 dtime, v3f *pos_f, v3f *speed_f, v3f accel_f, ActiveObject *self, bool collide_with_objects) |
| bool | collision_check_intersection (Environment *env, IGameDef *gamedef, const aabb3f &box_0, const v3f &pos_f, ActiveObject *self, bool collide_with_objects) |
| A simpler version of "collisionMoveSimple" that only checks whether a collision occurs at the given position. | |
Variables | |
| bool | g_collision_problems_encountered = false |
| Status if any problems were ever encountered during collision detection. | |
| #define PROFILER_NAME | ( | text | ) | (dynamic_cast<ServerEnvironment*>(env) ? ("Server: " text) : ("Client: " text)) |
Referenced by collision_check_intersection(), and collisionMoveSimple().
|
static |
References BS, CONTENT_IGNORE, MapNode::getCollisionBoxes(), MapNode::getContent(), Environment::getMap(), MapNode::getNeighbors(), Map::getNode(), getNodeBox(), IGameDef::getNodeDefManager(), ContentFeatures::groups, intToFloat(), itemgroup_get(), p(), and ContentFeatures::walkable.
Referenced by collision_check_intersection(), and collisionMoveSimple().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References BS, ClientEnvironment::getActiveObjects(), LocalPlayer::getCAO(), LocalPlayer::getCollisionbox(), ClientEnvironment::getLocalPlayer(), ServerEnvironment::getObjectsInsideRadius(), and LocalPlayer::getPosition().
Referenced by collision_check_intersection(), and collisionMoveSimple().
Here is the call graph for this function:
Here is the caller graph for this function:| CollisionAxis axisAlignedCollision | ( | const aabb3f & | staticbox, |
| const aabb3f & | movingbox, | ||
| const v3f | speed, | ||
| f32 * | dtime ) |
References COLLISION_AXIS_NONE, COLLISION_AXIS_X, COLLISION_AXIS_Y, and COLLISION_AXIS_Z.
Referenced by collisionMoveSimple(), and TestCollision::testAxisAlignedCollision().
Here is the caller graph for this function:| bool collision_check_intersection | ( | Environment * | env, |
| IGameDef * | gamedef, | ||
| const aabb3f & | box_0, | ||
| const v3f & | pos_f, | ||
| ActiveObject * | self = nullptr, | ||
| bool | collide_with_objects = true ) |
A simpler version of "collisionMoveSimple" that only checks whether a collision occurs at the given position.
| self | (optional) ActiveObject to ignore in the collision detection. |
true when box_0 truly intersects with a node or object. Touching faces are not counted as intersection. References add_area_node_boxes(), add_object_boxes(), BS, floatToInt(), g_profiler, PRECISION_MICRO, PROFILER_NAME, and SPT_AVG.
Referenced by LocalPlayer::move().
Here is the call graph for this function:
Here is the caller graph for this function:| collisionMoveResult collisionMoveSimple | ( | Environment * | env, |
| IGameDef * | gamedef, | ||
| const aabb3f & | box_0, | ||
| f32 | stepheight, | ||
| f32 | dtime, | ||
| v3f * | pos_f, | ||
| v3f * | speed_f, | ||
| v3f | accel_f, | ||
| ActiveObject * | self = NULL, | ||
| bool | collide_with_objects = true ) |
| self | (optional) ActiveObject to ignore in the collision detection. |
References add_area_node_boxes(), add_object_boxes(), CollisionInfo::axis, axisAlignedCollision(), BS, collisionMoveResult::collides, COLLISION_AXIS_NONE, COLLISION_AXIS_X, COLLISION_AXIS_Y, COLLISION_AXIS_Z, COLLISION_NODE, COLLISION_OBJECT, collisionMoveResult::collisions, DTIME_LIMIT, floatToInt(), g_collision_problems_encountered, g_profiler, MYMAX, MYMIN, CollisionInfo::new_pos, CollisionInfo::new_speed, CollisionInfo::node_p, CollisionInfo::object, CollisionInfo::old_speed, PRECISION_MICRO, PROFILER_NAME, rangelim, SPT_AVG, collisionMoveResult::standing_on_object, collisionMoveResult::touching_ground, CollisionInfo::type, warningstream, and wouldCollideWithCeiling().
Referenced by LocalPlayer::handleAutojump(), LocalPlayer::move(), LocalPlayer::old_move(), GenericCAO::step(), LuaEntitySAO::step(), Particle::step(), and TestCollision::testCollisionMoveSimple().
Here is the call graph for this function:
Here is the caller graph for this function:| bool wouldCollideWithCeiling | ( | const std::vector< NearbyCollisionInfo > & | cinfo, |
| const aabb3f & | movingbox, | ||
| f32 | y_increase, | ||
| f32 | d ) |
| bool g_collision_problems_encountered = false |
Status if any problems were ever encountered during collision detection.
Referenced by collisionMoveSimple(), and TestCollision::testCollisionMoveSimple().