summaryrefslogtreecommitdiff
path: root/src/collision.cpp
Commit message (Collapse)AuthorAge
* Add disable_jump to liquids and ladders (#7688)SmallJoker2019-06-10
| | | | | Remove second nodedef check by improving the colliding node detection Also remove the 2nd check in old_move, correct standing node a bit
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
| | | | | Update Android.mk Remove 'src/client' from include_directories
* Client-side autojump. Remove Android-only stepheight autojump (#7228)Ben Deutsch2018-11-22
| | | | | | | | Works by detecting a collision while moving forward and then simulating a jump. If the simulated jump is more successful, an artificial jump key press is injected in the client. Includes setting and key change GUI element for enabling and disabling this feature.
* Prevent objects from colliding with own child attachments (#7610)SmallJoker2018-08-05
| | | | | Also, use a better distance calculation for 'collide with objects'. Fixes the issue of a vehicle occasionally colliding with its own driver, causing one of the velocity components to be set to zero.
* Optimize a little bit isBlockInSight, adjustDist & collisions (#7193)Loïc Blot2018-04-04
| | | | * Use constexpr + unroll some calculations to cache definitively some calculations * Unroll some calls in collision code & use a constref instead of a copy in one occurence
* Fix various clang-tidy reported performance-type-promotion-in-math-fnLoïc Blot2018-04-03
|
* CollisionMoveSimple: Collide with 'ignore' nodesparamat2018-02-26
|
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
| | | | | | | | | * Rename IWritableNodeDefManager to NodeDefManager * Make INodeDefManager functions const * Use "const *NodeDefManager" instead of "*INodeDefManager" * Remove unused INodeDefManager class * Merge NodeDefManager and CNodeDefManager * Document NodeDefManager
* Change BS constant from implicit double to float (#6286)Jens Rottmann2017-08-20
| | | | | | | | the BS constant implicitly promotes all position calculations it is used in to double even though positions (= v3f) are only meant to be floats. There are many, many similar occurrences everywhere, but I'm not willing to hunt down all; I only fixed the little part I'm already familiar with.
* clientobject, clouds, collision, clientsimpleobject: code modernization (#6260)Loïc Blot2017-08-17
| | | | | | | | | | | | * clientobject, clouds, collision, clientsimpleobject: code modernization * use range-based for loops * simplify some tests * various code style fixes * use emplace_back instead of push_back when necessary * use auto on some iterators * use default operator when needed * unroll v3s16 creation on collisionMoveSimple
* Add tiny Y offset in collisionMoveSimple() to tweak performanceJens Rottmann2017-08-05
| | | | | | | | | | | | | | | Another small general problem: the player is always standing exactly on the bondary between 2 nodes e.g. Y=1.5 is exactly between nodes Y=1 and Y=2. floatToInt() and myround() will round +/-n.5 always 'outwards' to +/-(n+1), which means they behave differently depending on where you are: they round upwards above sea level and downwards when underground. This inconsistency comes from the way the coordinates are calculated, independent of the specific C++ code. The result is a tiny bit of lost performance when moving underground, because 1 node level more than necessary is checked for collisions. This can be amended by adding a tiny offset to minpos_f.Y, like @paramat suggested. This is not an elegant solution, but still better than wasting CPU.
* Fix player coordinate rounding in collisionMoveSimple() (#6197)Jens Rottmann2017-08-05
| | | | | | | | | | | | | | | | | | | | To determine the area (nodes) where a player movement took place collisionMoveSimple() first took the old/new player coordinates and rounded them to integers, then added the player character's collision box and implicitely rounded the result. This has 2 problems: Rounding the position and the box seperately, then adding the resulting integers means you get twice the rounding error. And implicit rounding always rounds towards 0.0, unlike floatToInt(), which rounds towards the closest integer. Previous (simplified) behavior: round(pos)+(int)box, for example player at Y=0.9, body is 1.75m high: round(0.9)+(int)1.75 = 1+1 = 2. ==> A character's height of 1.75m always got rounded down to 1m, its width of +/-0.3 even became 0. Fixed by adding the floats first, then rounding properly: round(pos+box) = round(0.9+1.75) = round(2.65) = 3.
* C++11 patchset 9: move hardcoded init parameters to class definitions (part ↵Loïc Blot2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | 1) (#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
* Environment & IGameDef code refactoring (#4985)Ner'zhul2017-01-09
| | | | | | | | | | | | | | | | | | | | | * Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
* Move ServerEnvironment to dedicated cpp/header filesLoic Blot2017-01-08
| | | | * also cleanup some unneeded inclusions
* Move ClientEnvironment to dedicated cpp/header filesLoic Blot2017-01-08
|
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
| | | | | | | | | | | | | | | | | * Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
* Collision: Improve performance by combining 6 vectors into 1 using a structShadowNinja2016-09-15
|
* Fix #3955 (player dying on login).Nathanaël Courant2016-04-06
| | | | | | It was caused by player not moving because fall was prevented, but their velocity still increasing, causing fatal fall damage when world was finally loaded. This commit fixes it by setting player velocity to zero when the world around them is not loaded.
* Allow nodes to specify which sides to connect to.Auke Kok2016-03-12
| | | | | | | | | | | | | | | | NDT_CONNECTED attempts to connect to any side of nodes that it can connect to, which is troublesome for FACEDIR type nodes that generally may only have one usable face, and can be rotated. We introduce a node parameter `connect_sides` that is valid for any node type. If specified, it lists faces of the node (in "top", "bottom", "front", "left", "back", "right", form, as array) that connecting nodeboxes can connect to. "front" corresponds to the south facing side of a node with facedir = 0. If the node is rotatable using *simple* FACEDIR, then the attached face is properly rotated before checking. This allows e.g. a chest to be attached to only from the rear side.
* Nodebox: Allow nodeboxes to "connect"Auke Kok2016-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new nodebox type "connected", and allow these nodes to have optional nodeboxes that connect it to other connecting nodeboxes. This is all done at scenedraw time in the client. The client will inspect the surrounding nodes and if they are to be connected to, it will draw the appropriate connecting nodeboxes to make those connections. In the node_box definition, we have to specify separate nodeboxes for each valid connection. This allows us to make nodes that connect only horizontally (the common case) by providing optional nodeboxes for +x, -x, +z, -z directions. Or this allows us to make wires that can connect up and down, by providing nodeboxes that connect it up and down (+y, -y) as well. The optional nodeboxes can be arrays. They are named "connect_top, "connect_bottom", "connect_front", "connect_left", "connect_back" and "connect_right". Here, "front" means the south facing side of the node that has facedir = 0. Additionally, a "fixed" nodebox list present will always be drawn, so one can make a central post, for instance. This "fixed" nodebox can be omitted, or it can be an array of nodeboxes. Collision boxes are also updated in exactly the same fashion, which allows you to walk over the upper extremities of the individual node boxes, or stand really close to them. You can also walk up node noxes that are small in height, all as expected, and unlike the NDT_FENCELIKE nodes. I've posted a screenshot demonstrating the flexibility at http://i.imgur.com/zaJq8jo.png In the screenshot, all connecting nodes are of this new subtype. Transparent textures render incorrectly, Which I don't think is related to this text, as other nodeboxes also have issues with this. A protocol bump is performed in order to be able to send older clients a nodeblock that is usable for them. In order to avoid abuse of users we send older clients a "full-size" node, so that it's impossible for them to try and walk through a fence or wall that's created in this fashion. This was tested with a pre-bump client connected against a server running the new protocol. These nodes connect to other nodes, and you can select which ones those are by specifying node names (or group names) in the connects_to string array: connects_to = { "group:fence", "default:wood" } By default, nodes do not connect to anything, allowing you to create nodes that always have to be paired in order to connect. lua_api.txt is updated to reflect the extension to the node_box API. Example lua code needed to generate these nodes can be found here: https://gist.github.com/sofar/b381c8c192c8e53e6062
* Revert "Fix jumping at node edge"nerzhul2016-03-01
| | | | | | This reverts commit 60dc01dc258db842e229351b871d0989e3e7d62c. This fixes issue #3773
* Little collision.cpp cleanupsLoic Blot2016-02-20
|
* Fix jumping at node edgegregorycu2016-02-19
|
* Don't pass non-const references to collision methodsest312016-01-29
| | | | | Non const references cause a lot of confusion with behaviour of code, and are disallowed by minetest style guide.
* Make collisionMoveSimple time overflow message written to log/show up at max ↵Sapier2015-12-29
| | | | once per step
* Fix jittering sounds on entities (fixes #2974)BlockMen2015-10-26
|
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
| | | | Remove DTIME macro and its uses, too
* Fix falling through nodes on world load (fixes #2784)Christof Kaufmann2015-09-26
| | | | | | | | | | | On world load the collision code can not see node boxes, since the nodes have not been loaded. Thus it collided only at the next full node. However, standing on a slab on world load leaded to sinking into it until the world finished loading. Then one maybe fell further, if the node below was not walkable. Now, with this commit, when no node around the player has been loaded it simply does not move the player.
* Change i++ to ++iDavid Jones2015-08-25
|
* Remove profiler.h include where it's not needed. Remove some unreachable and ↵Loic Blot2015-07-21
| | | | very old code
* Use std::vector instead of std::set for Environment::getObjectsInsideRadiusLoic Blot2015-04-16
| | | | | We are only iterating sequentially, we don't need a set here Also use a vector reference instead of a copy
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
| | | | | | | | | | | | Move debug streams to log.cpp|h Move GUI-related globals to clientlauncher Move g_settings and g_settings_path to settings.cpp|h Move g_menuclouds to clouds.cpp|h Move g_profiler to profiler.cpp|h
* For usages of assert() that are meant to persist in Release builds (when ↵Craig Robbins2015-03-07
| | | | NDEBUG is defined), replace those usages with persistent alternatives
* collisionMoveSimple: use std::vector instead of std::list, this improve the ↵Loic Blot2015-03-05
| | | | performances
* Remove most exceptions from getNode() (and variants)Craig Robbins2014-11-14
|
* Custom collision boxes node property.RealBadAngel2014-10-19
|
* Add an option to disable object <-> object collision for Lua entitiesPilzAdam2013-07-20
|
* Disable collision fix, its broke unit testsproller2013-07-01
|
* Fix sand, gravel falling stuckproller2013-06-30
|
* Fix nearly all warningskwolekr2013-05-19
|
* fix objects colliding with its own collision boxessapier2013-04-09
|
* Limit speed in collisionMoveResult for avoiding hangsEsteban I. Ruiz Moreno2013-04-03
|
* Closed add object <-> object collision handlingsapier2013-03-28
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* add limit for steps to avoid runaway memory consumption by collision handlingsapier2013-01-16
|
* Add bouncy node groupPerttu Ahola2012-09-01
|
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
|
* Switch the license to be LGPLv2/later, with small parts still remaining as ↵Perttu Ahola2012-06-05
| | | | GPLv2/later, by agreement of major contributors