summaryrefslogtreecommitdiff
path: root/servers/physics_2d/space_2d_sw.cpp
AgeCommit message (Collapse)Author
2021-02-24Merge pull request #45863 from nekomatata/physics-queries-disabled-shapesRémi Verschelde
Fix physics queries not filtering out disabled collision shapes
2021-02-17Fix test_body_motion recoveryPouleyKetchoupp
This change makes test_body_motion more reliable when the kinematic body recovers from being stuck. - When recovery occurs, the rest information is generated, in order to make sure collision results from test_move, move_and_collide and move_and_slide are consistent and return a collision in case of overlap. - The new calculation for recovery vector makes sure the recovery is never more than the overlap depth between shapes. This can help with cases where the kinematic body overlaps with several shapes. Recovery is made iteratively, without forcing a full overlap at each step. This helps with getting proper rest information when recovery occurs. - One Way Collision: When attempting motion, contact direction is checked against motion before skipping in order to solve cases where kinematic bodies can sink into one-way collision shapes. Rest info now sets max contact depth in order to properly handle one-way collision. - Low speed motion is now handled in the rest info, by never setting min_allowed_depth lower than motion length. Separation is always applied with full margin, otherwise contact is lost when low speed motion occurs right after higher speed motion. - Similar changes are applied to 3D in order to make 2D and 3D consistent.
2021-02-09Fix physics queries not filtering out disabled collision shapesPouleyKetchoupp
This change allows collide_shape, intersect_shape, cast_motion and rest_info in both 2D and 3D to ignore disabled shapes and make them consistent with the physics simulation. In some other cases, _cull_aabb_for_body is used and filters shapes out internally, but whenever a physics query uses the broadphase directly without calling _cull_aabb_for_body, disabled shapes can be returned and need to be filtered out.
2021-02-01Merge pull request #37547 from aaronfranke/tauRémi Verschelde
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-01-28Use real_t in physics codeAaron Franke
2021-01-14Merge pull request #43923 from madmiraal/fix-43588Rémi Verschelde
Fix cast_motion sometimes failing
2021-01-09Use Math_TAU and deg2rad/rad2deg in more places and optimize codeAaron Franke
2021-01-07Fix multiple issues with one-way collisionsMarcel Admiraal
For RigidBodies, uses the collision normal determined by relative motion to determine whether or not a one-way collision has occurred. For KinematicBodies, performs additional checks to ensure a one-way collision has occurred, and averages the recovery step over all collision shapes. Co-authored-by: Sergej Gureev <sergej.gureev@relex.fi>
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-11-27Fix cast_motion sometimes failingMarcel Admiraal
- Fixes Godot physics failing when the cast Shape is inside of, or already colliding with another Shape. - Fixes Bullet physics failing when there is no motion. - Ensures Godot and Bullet physics behave the same. - Updates the documentation to exclude the caveats for the failures and differences.
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-07-27Revert "Allow Area2D and 3D mouse events without a collision layer"Rémi Verschelde
This reverts commit 7eebb06b5571437828d8c5099558c303c72cd1f4.
2020-07-10Allow Area2D and 3D mouse events without a collision layerTomasz Chabora
Co-authored-by: madmiraal <madmiraal@users.noreply.github.com>
2020-06-08Test collision mask before creating constraint pair in Godot physics ↵Marcel Admiraal
broadphase 2D and 3D.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Enforce use of bool literals instead of integersRémi Verschelde
Using clang-tidy's `modernize-use-bool-literals`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-28More server renames for consistency after #37361Rémi Verschelde
2020-03-27Renaming of servers for coherency.Juan Linietsky
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-02-12ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky
32 bits.
2020-02-11Refactored RID/RID_Owner to always use O(1) allocation.Juan Linietsky
* Implements a growing chunked allocator * Removed redudant methods get and getptr, only getornull is supported now.
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-08-07Add some code changes/fixes proposed by Coverity and Clang Tidyqarmin
2019-06-26Some code changed with Clang-Tidyqarmin
2019-05-19Fix typos with codespellRémi Verschelde
Using codespell 1.15.0. Method: ``` $ cat > ../godot-word-whitelist.txt << EOF ang curvelinear doubleclick leapyear lod merchantibility nd numer ois ony que seeked synching te uint unselect webp EOF $ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po" $ git diff // undo unwanted changes ```
2019-04-08Small fixes, mostly dupicated codeqarmin
2019-02-21Fixed bugs in test body motion and removed unnecesary test in ↵Juan Linietsky
move_and_slide. Fixes #25968
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-02-16Skip disabled shape when getting rest info. Fixes #25941Juan Linietsky
2019-02-16Support multiple ray shapes in kinematicbody, fixes #25050Juan Linietsky
2019-02-16Add a minimum treshold for acquiring rest contacts to avoid numerical ↵Juan Linietsky
precision issues. Fixes #25074
2019-02-16Allow kinematic bodies without shapes to still move, fixes #24775Juan Linietsky
2019-02-16Make ray shapes not work with OWC. They don't make practical sense together. ↵Juan Linietsky
Closes #25532
2019-01-21Cleanup after @reduz :)Rémi Verschelde
Fixes #25172.
2019-01-18-Re-added margins in one way collision (made in a more user friendly way ↵Juan Linietsky
than in Godot 2.1), fixes #23860 -Fixed potential bug in OWC (i dont think anyone had it but..)
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-11-14Ensure that even at slow speed, you will always get collision using ↵Juan Linietsky
kinematic motion. Fixes #16250
2018-11-10Make sure rotated shapes with one way direction collisions work, fixes #12791Juan Linietsky
2018-11-07Merge pull request #21386 from RandomShaper/fix-picking-in-canvas-layersJuan Linietsky
Fix picking in CanvasLayer
2018-11-03<fales> end of the week ;-)Juan Linietsky
2018-11-03Fix condition testJuan Linietsky
2018-11-02Simple workaround to make one way moving platforms work, fixes #9399Juan Linietsky
2018-11-02-Fix problem in OWC logic closes #11357Juan Linietsky
-Fix problem with kinematic move and disabled shapes, in both 2D and 3D
2018-10-24Add some limits on the Editor SettingsSuperwaitsum
2018-09-13Merge pull request #21982 from luzpaz/misc-typosRémi Verschelde
Misc. typos