Minetest  5.4.0
collision.cpp File Reference
#include "collision.h"
#include <cmath>
#include "mapblock.h"
#include "map.h"
#include "nodedef.h"
#include "gamedef.h"
#include "client/clientenvironment.h"
#include "client/localplayer.h"
#include "serverenvironment.h"
#include "server/serveractiveobject.h"
#include "util/timetaker.h"
#include "profiler.h"
+ Include dependency graph for collision.cpp:

Classes

struct  NearbyCollisionInfo
 

Functions

static f32 truncate (const f32 val, const f32 factor)
 
static v3f truncate (const v3f &vec, const f32 factor)
 
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 void getNeighborConnectingFace (const v3s16 &p, const NodeDefManager *nodedef, Map *map, MapNode n, int v, int *neighbors)
 
collisionMoveResult collisionMoveSimple (Environment *env, IGameDef *gamedef, f32 pos_max_d, const aabb3f &box_0, f32 stepheight, f32 dtime, v3f *pos_f, v3f *speed_f, v3f accel_f, ActiveObject *self, bool collideWithObjects)
 

Function Documentation

◆ axisAlignedCollision()

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:

◆ collisionMoveSimple()

collisionMoveResult collisionMoveSimple ( Environment env,
IGameDef gamedef,
f32  pos_max_d,
const aabb3f box_0,
f32  stepheight,
f32  dtime,
v3f pos_f,
v3f speed_f,
v3f  accel_f,
ActiveObject self,
bool  collideWithObjects 
)

References CollisionInfo::axis, axisAlignedCollision(), NearbyCollisionInfo::bouncy, NearbyCollisionInfo::box, BS, collisionMoveResult::collides, ActiveObject::collideWithObjects(), COLLISION_AXIS_NONE, COLLISION_AXIS_X, COLLISION_AXIS_Y, COLLISION_AXIS_Z, COLLISION_NODE, COLLISION_OBJECT, collisionMoveResult::collisions, CONTENT_IGNORE, ContentFeatures::drawtype, floatToInt(), g_profiler, NodeDefManager::get(), ClientEnvironment::getActiveObjects(), LocalPlayer::getCAO(), LocalPlayer::getCollisionbox(), ActiveObject::getCollisionBox(), MapNode::getCollisionBoxes(), MapNode::getContent(), ClientEnvironment::getLocalPlayer(), Environment::getMap(), getNeighborConnectingFace(), Map::getNode(), getNodeBox(), IGameDef::getNodeDefManager(), ServerEnvironment::getObjectsInsideRadius(), LocalPlayer::getParent(), LocalPlayer::getPosition(), ContentFeatures::groups, infostream, intToFloat(), NearbyCollisionInfo::is_step_up, NearbyCollisionInfo::is_unloaded, NearbyCollisionInfo::isObject(), itemgroup_get(), MYMAX, MYMIN, IGameDef::ndef(), NDT_NODEBOX, CollisionInfo::new_speed, ContentFeatures::node_box, CollisionInfo::node_p, NODEBOX_CONNECTED, NearbyCollisionInfo::obj, CollisionInfo::object, CollisionInfo::old_speed, p(), CollisionInfo::plane, NearbyCollisionInfo::position, rangelim, SPT_AVG, collisionMoveResult::standing_on_object, collisionMoveResult::touching_ground, truncate(), CollisionInfo::type, NodeBox::type, ContentFeatures::walkable, warningstream, and wouldCollideWithCeiling().

Referenced by LocalPlayer::handleAutojump(), LocalPlayer::move(), LocalPlayer::old_move(), Particle::step(), LuaEntitySAO::step(), and GenericCAO::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNeighborConnectingFace()

static void getNeighborConnectingFace ( const v3s16 p,
const NodeDefManager nodedef,
Map map,
MapNode  n,
int  v,
int *  neighbors 
)
inlinestatic

References Map::getNode(), NodeDefManager::nodeboxConnects(), and p().

Referenced by collisionMoveSimple().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ truncate() [1/2]

static f32 truncate ( const f32  val,
const f32  factor 
)
inlinestatic

Referenced by collisionMoveSimple(), and truncate().

+ Here is the caller graph for this function:

◆ truncate() [2/2]

static v3f truncate ( const v3f vec,
const f32  factor 
)
inlinestatic

References truncate().

+ Here is the call graph for this function:

◆ wouldCollideWithCeiling()

bool wouldCollideWithCeiling ( const std::vector< NearbyCollisionInfo > &  cinfo,
const aabb3f movingbox,
f32  y_increase,
f32  d 
)

Referenced by collisionMoveSimple().

+ Here is the caller graph for this function: