summaryrefslogtreecommitdiffstats
path: root/scene/2d/physics_body_2d.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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!
* fix stop_on_slope affecting sliding up slopespiratesephiroth2018-12-141-12/+4
|
* Fixed using move_and_slide with stop_on_slope stopping too earlyDualMatrix2018-11-291-1/+1
| | | | | | This makes it stop exactly on the slope, I'm not 100% sure if this if this is the correct fix let me know what you think. Fixes #23675
* Make sure sync to physics is disabled in editor, fixes #20230Juan Linietsky2018-11-211-0/+4
|
* Merge pull request #17530 from bojidar-bg/17516-detect-deltaRémi Verschelde2018-11-121-1/+2
|\ | | | | Make it possible to call move_and_slide from _process, even if it is not recommended
| * Make it possible to call move_and_slide from _process, even if it is not ↵Bojidar Marinov2018-11-081-1/+2
| | | | | | | | | | | | | | | | recommended Previously, it would reuse the _physics_process delta, causing it to move faster on faster framerates Fixes #17516
* | Merge pull request #23090 from DavidSichma/inconsistent-kinematicRémi Verschelde2018-11-121-6/+6
|\ \ | |/ |/| Consistency in KinematicBody
| * Fix inconsistency in KinematicBodyDavid Sichma2018-10-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | - moved new infinite_inertia argument of move_and_slide and move_and_slide_with_snap in KinematicBody and KinematicBody2D to the end if not already there. This makes the order of arguments consistent and should keep projects from 3.0 compatible as this argument did not exist in 3.0. Docs updated accordingly. - renamed max_bounces to max_slides for consistency. Docs updated accordingly. - the argument infinite_inertia in test_move is now optional, as it is in every other movement related method. This closes #22829.
* | -Moved EditorDefaultValue to ClassDB, made it coreJuan Linietsky2018-11-081-8/+8
| | | | | | | | -Removed one and zero hints for properties, replaced by default value
* | Add method get_collision_exceptionsGuilherme Recchi Cardozo2018-11-011-0/+19
|/ | | | | | | | Adding this method to PhysicsBody, PhysicsBody2D and SoftBody. It returns a list of nodes included in collision exceptions. Fixes #23235, cheers!
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-2/+2
| | | | | | This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
* PhysicsBody: Don't create PhysicsMaterial override for default friction/bounceRémi Verschelde2018-09-021-2/+19
| | | | And don't save physics_material_override if null.
* Improve ClassDB information for some some signal parametersKelly Thomas2018-09-011-6/+6
|
* Physics: Properly obsolete friction and bounce propertiesRémi Verschelde2018-08-291-23/+13
| | | | | | | | Without this change any new PhysicsBody would show deprecation warnings due to default values for friction and bounce being defined. It also enforced a physics material override even when using default values.
* Fix operator precedence in PhysicsBody2D::set_weightRémi Verschelde2018-08-291-2/+2
| | | | Fixes #16038.
* Make some debug prints verbose-only, remove othersRémi Verschelde2018-08-241-7/+0
|
* Revert "Take CanvasLayer transform into account for 2D physics"Rémi Verschelde2018-08-231-14/+27
| | | | | | This reverts commit 4839e5f6d9ed1c0afee933009ab44b9913310d27. Fixes #21289.
* Take CanvasLayer transform into account for 2D physicsPedro J. Estébanez2018-08-211-27/+14
| | | | Fixes #18073.
* Added ray shape and move_and_slide with snapping on 3D.Andrea Catania2018-08-191-18/+30
| | | | Added stop_on_slope on 2d part
* apply a threshold for floor angle, fixes #16037, fixes #15632Juan Linietsky2018-08-101-2/+5
|
* Merge pull request #20381 from AndreaCatania/phymat_2Juan Linietsky2018-08-071-18/+12
|\ | | | | Improved Physics material
| * Removed physics material combination mode. Added rough and absorbent ↵Andrea Catania2018-08-071-18/+12
| | | | | | | | parameter to material. Fixed 'change' signal connection
* | Fix PhysicsBody build with deprecated=noRémi Verschelde2018-07-271-2/+11
| | | | | | | | Fixes #20483.
* | Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
* | Modified RigidBody, PhysicsDirectBodyState, PhysicsServer, and their ↵Tiger Caldwell2018-07-241-0/+20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | respective 2D counterparts to be more consistent and to include more useful methods. RigidBody: - Added add_central_force - Added add_force - Added add_torque - Added apply_central_impulse RigidBody2D: - Added add_central_force - Added add_torque - Added apply_central_impulse - Added apply_torque_impulse PhysicsDirectBodyState: - Added apply_central_impulse Physics2DDirectBodyState: - Added add_central_force - Added add_force - Added add_torque - Added apply_central_impulse - Added apply_impulse - Added apply_torque_impulse PhysicsServer: - Added body_add_force - Added body_add_torque - Added body_add_central_force - Added body_apply_central_impulse Physics2DServer: - Added body_add_torque - Added body_add_central_force - Added body_apply_central_impulse - Added body_apply_torque_impulse Also fixed some small bugs along the way
* Merge pull request #12403 from AndreaCatania/phymatJuan Linietsky2018-07-231-16/+144
|\ | | | | Physics material
| * Implemented physics materialAndreaCatania2018-05-111-16/+144
| | | | | | | | | | | | Hidden a function Fixed travis static check