summaryrefslogtreecommitdiffstats
path: root/scene/2d/physics_body_2d.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-4/+4
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Refactor MethodBind to use variadic templatesreduz2020-10-181-2/+1
| | | | Removed make_binders and the old style generated binders.
* Remove old RigidBody layers property and methods.Marcel Admiraal2020-10-131-13/+0
|
* Merge pull request #38743 from arrowinaknee/node-config-warningsRémi Verschelde2020-10-011-1/+1
|\ | | | | Update all get_configuration_warning() to retrieve warnings from the parent
| * Update all get_configuration_warning to retrieve warnings from the parentArrowInAKnee2020-05-161-1/+1
| |
* | Merge pull request #37350 from aaronfranke/force-impulseRémi Verschelde2020-07-021-7/+7
|\ \ | | | | | | Refactor physics force and impulse code to use (force, position) order
| * | Refactor physics force and impulse codeAaron Franke2020-06-021-7/+7
| |/
* / Normalise p_up_direction vector in move_and_slide() andMarcel Admiraal2020-06-161-9/+11
|/ | | | | move_and_slide_with_snap() and fix tolerance in move_and_slide_with_snap() max floor angle.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-21/+37
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+21
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-121/+0
| | | | | | | | | | | | | | 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.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-1/+2
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* Add proper type to most public API uses of ArrayJuan Linietsky2020-04-211-3/+3
|
* Replace NULL with nullptrlupoDharkael2020-04-021-13/+13
|
* doc: Update classref with node renamesRémi Verschelde2020-03-301-2/+2
| | | | A few extra renames for classes which were missed in last week's PRs.
* More server renames for consistency after #37361Rémi Verschelde2020-03-281-2/+2
|
* Fixed missed occurrences in #37361 renamings.dankan18902020-03-281-1/+1
|
* Renaming of servers for coherency.Juan Linietsky2020-03-271-64/+64
| | | | | | | | | | VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
* Signals: Manually port most of remaining connect_compat usesRémi Verschelde2020-02-281-19/+14
| | | | | | | | It's tedious work... Some can't be ported as they depend on private or protected methods of different classes, which is not supported by callable_mp (even if it's a class inherited by the current one).
* Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky2020-02-251-10/+10
| | | | | | | | | | | | | | | | | | | | | - 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.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-12/+12
| | | | objects and made them default.
* Merge pull request #36145 from akien-mga/remove-deprecated-friction-bounceRémi Verschelde2020-02-121-138/+0
|\ | | | | Remove deprecated PhysicsBody friction and bounce parameters
| * Remove deprecated PhysicsBody friction and bounce parametersRémi Verschelde2020-02-121-138/+0
| | | | | | | | They were replaced in 3.1 by PhysicsMaterial properties via #12403.
* | ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky2020-02-121-2/+2
|/ | | | 32 bits.
* Fixes get_floor_normal() returning the user defined floor_normal.Marcel Admiraal2020-01-151-3/+3
| | | | | | | | | | | | When there is no collision with a floor the get_floor_normal() function should return the zero vector to be consistent with get_floor_velocity(). Renames floor_normal to up_direction in all bindings. Updates the documentation of get_floor_normal() and get_floor_velocity() to make it clear when the values are valid. Updates the documentation for move_and_slide() and move_and_slide_with_snap() to use the new up_direction parameter name.
* Added function to expose floor normal, useful to correctly calculate player ↵Andrea Catania2020-01-101-11/+20
| | | | | | velocity. This work has been kindly sponsored by IMVU.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | 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.
* Add a range property hint for the number of contacts reportedHugo Locurcio2019-12-211-1/+1
| | | | This closes #34505.
* Ensure move_and_slide() is consistent between the 2D and 3D versions.Marcel Admiraal2019-12-021-19/+15
| | | | | | | | | | | | | | | | | | | In the 3D version: - Partially revert #20908 that was reverted in the 2D version as part of #21653. This ensures that the Vector returned is always perpendicular to the surface collided with; and not the floor_normal Vector passed to the function when on a floor. - Include an update of the floor velocity before multiplying by the time delta, which was added to the 2D version as part of commit 13a8014. In the 2D version: - Use the Vector2.slide() function instead of Vector2.tangent() to adjust the amount of motion the stop_on_slope undoes to ensure that it is in the right direction. This is a implementation of the 3D approach from #30588. - Combine the !found_collision and motion == Vector2() checks for break. - Other minor formating changes to make the functions look identical. Also renamed some variables to align with their use.
* Merge pull request #32051 from qarmin/some_error_explanationRémi Verschelde2019-09-251-3/+3
|\ | | | | Added some obvious errors explanations
| * Added some obvious errors explanationsqarmin2019-09-251-3/+3
| |
* | Fix misc. source comment typosluz.paz2019-09-191-1/+1
|/ | | Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
* Merge pull request #31476 from SoulForMachine/fix-move-and-slide-errorRémi Verschelde2019-09-031-0/+8
|\ | | | | Prevent move_and_slide() to generate an error.
| * Prevent move_and_slide() to generate an error.Milan Davidovic2019-08-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When moving KinematicBody2D from one scene to another and not freeing the old scene, the first call to move_and_slide() in the new scene will generate an error because KinematicBody2D keeps internaly a RID on_floor_body of a body resource in the old scene which no more has a space assigned. To fix this, on_floor_body is set to empty RID in response to NOTIFICATION_ENTER_TREE notification of KinematicBody2D and KinematicBody. Also all other data related to move_and_slide() is reset: floor, ceiling, wall flags, colliders vector, floor_velocity. This fixes #31416.
* | Merge pull request #31014 from DavidSichma/kinematic_angleRémi Verschelde2019-08-231-2/+2
|\ \ | | | | | | Fix floor_max_angle comparison for impossible angles
| * | Fix floor_max_angle comparison for impossible anglesDavid Sichma2019-08-011-2/+2
| | |
* | | Fix custom inertia in physics2d, closes#30838RaphaelHunter2019-08-221-1/+1
| |/ |/|
* | Remove ERR_EXPLAIN from scene/* codeTomasz Chabora2019-08-091-28/+11
|/
* Tweak Area and PhysicsBody damping setting hints for consistencyHugo Locurcio2019-07-311-2/+2
| | | | This partially addresses #19182.
* Improve the node configuration warning displayHugo Locurcio2019-07-091-1/+1
| | | | | | | - Refer to properties explicitly when possible - When multiple warnings are returned, always separate them by one blank line to make them easier to distinguish - Improve grammar and formatting
* Add default values to the editor help, docs, and generated RSTBojidar Marinov2019-06-271-1/+1
| | | | | Also, make spacing of "=" in the editor help a bit more consistent. Closes #16086
* Fix error macro calls not ending with semicolonRémi Verschelde2019-06-111-16/+16
| | | | | | | It's not necessary, but the vast majority of calls of error macros do have an ending semicolon, so it's best to be consistent. Most WARN_DEPRECATED calls did *not* have a semicolon, but there's no reason for them to be treated differently.
* Small fixes, mostly dupicated codeqarmin2019-04-081-3/+0
|
* Add missing check for 2d physics bounce and friction settersKanabenki2019-03-181-4/+4
| | | | The override check was already present for 3d physics but missing for 2d
* Specifically error when users try to use sync to physics and move and slide, ↵Juan Linietsky2019-03-041-0/+3
| | | | closes #26545
* Ensure move and slide snap respects stop on slope, fixes #26180Juan Linietsky2019-02-231-0/+6
|
* Fixed bugs in test body motion and removed unnecesary test in ↵Juan Linietsky2019-02-211-3/+0
| | | | move_and_slide. Fixes #25968
* Change snapping to only happen when the floor normal remains as floor, fixes ↵Juan Linietsky2019-02-161-6/+14
| | | | #22312
* Make sure stop on slope can have a tiny bit of precision edge.Juan Linietsky2019-02-161-1/+1
|
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!