summaryrefslogtreecommitdiff
path: root/scene/2d/physics_body_2d.cpp
AgeCommit message (Collapse)Author
2019-12-02Ensure move_and_slide() is consistent between the 2D and 3D versions.Marcel Admiraal
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.
2019-09-25Merge pull request #32051 from qarmin/some_error_explanationRémi Verschelde
Added some obvious errors explanations
2019-09-25Added some obvious errors explanationsqarmin
2019-09-19Fix misc. source comment typosluz.paz
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 `
2019-09-03Merge pull request #31476 from SoulForMachine/fix-move-and-slide-errorRémi Verschelde
Prevent move_and_slide() to generate an error.
2019-08-26Prevent move_and_slide() to generate an error.Milan Davidovic
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.
2019-08-23Merge pull request #31014 from DavidSichma/kinematic_angleRémi Verschelde
Fix floor_max_angle comparison for impossible angles
2019-08-22Fix custom inertia in physics2d, closes#30838RaphaelHunter
2019-08-09Remove ERR_EXPLAIN from scene/* codeTomasz Chabora
2019-08-01Fix floor_max_angle comparison for impossible anglesDavid Sichma
2019-07-31Tweak Area and PhysicsBody damping setting hints for consistencyHugo Locurcio
This partially addresses #19182.
2019-07-09Improve the node configuration warning displayHugo Locurcio
- 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
2019-06-27Add default values to the editor help, docs, and generated RSTBojidar Marinov
Also, make spacing of "=" in the editor help a bit more consistent. Closes #16086
2019-06-11Fix error macro calls not ending with semicolonRémi Verschelde
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.
2019-04-08Small fixes, mostly dupicated codeqarmin
2019-03-18Add missing check for 2d physics bounce and friction settersKanabenki
The override check was already present for 3d physics but missing for 2d
2019-03-04Specifically error when users try to use sync to physics and move and slide, ↵Juan Linietsky
closes #26545
2019-02-23Ensure move and slide snap respects stop on slope, fixes #26180Juan Linietsky
2019-02-21Fixed bugs in test body motion and removed unnecesary test in ↵Juan Linietsky
move_and_slide. Fixes #25968
2019-02-16Change snapping to only happen when the floor normal remains as floor, fixes ↵Juan Linietsky
#22312
2019-02-16Make sure stop on slope can have a tiny bit of precision edge.Juan Linietsky
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-14fix stop_on_slope affecting sliding up slopespiratesephiroth
2018-11-29Fixed using move_and_slide with stop_on_slope stopping too earlyDualMatrix
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
2018-11-21Make sure sync to physics is disabled in editor, fixes #20230Juan Linietsky
2018-11-12Merge pull request #17530 from bojidar-bg/17516-detect-deltaRémi Verschelde
Make it possible to call move_and_slide from _process, even if it is not recommended
2018-11-12Merge pull request #23090 from DavidSichma/inconsistent-kinematicRémi Verschelde
Consistency in KinematicBody
2018-11-08Make it possible to call move_and_slide from _process, even if it is not ↵Bojidar Marinov
recommended Previously, it would reuse the _physics_process delta, causing it to move faster on faster framerates Fixes #17516
2018-11-08-Moved EditorDefaultValue to ClassDB, made it coreJuan Linietsky
-Removed one and zero hints for properties, replaced by default value
2018-11-01Add method get_collision_exceptionsGuilherme Recchi Cardozo
Adding this method to PhysicsBody, PhysicsBody2D and SoftBody. It returns a list of nodes included in collision exceptions. Fixes #23235, cheers!
2018-10-17Fix inconsistency in KinematicBodyDavid Sichma
- 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.
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
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.
2018-09-02PhysicsBody: Don't create PhysicsMaterial override for default friction/bounceRémi Verschelde
And don't save physics_material_override if null.
2018-09-01Improve ClassDB information for some some signal parametersKelly Thomas
2018-08-29Physics: Properly obsolete friction and bounce propertiesRémi Verschelde
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.
2018-08-29Fix operator precedence in PhysicsBody2D::set_weightRémi Verschelde
Fixes #16038.
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde
2018-08-23Revert "Take CanvasLayer transform into account for 2D physics"Rémi Verschelde
This reverts commit 4839e5f6d9ed1c0afee933009ab44b9913310d27. Fixes #21289.
2018-08-21Take CanvasLayer transform into account for 2D physicsPedro J. Estébanez
Fixes #18073.
2018-08-19Added ray shape and move_and_slide with snapping on 3D.Andrea Catania
Added stop_on_slope on 2d part
2018-08-10apply a threshold for floor angle, fixes #16037, fixes #15632Juan Linietsky
2018-08-07Merge pull request #20381 from AndreaCatania/phymat_2Juan Linietsky
Improved Physics material
2018-08-07Removed physics material combination mode. Added rough and absorbent ↵Andrea Catania
parameter to material. Fixed 'change' signal connection
2018-07-27Fix PhysicsBody build with deprecated=noRémi Verschelde
Fixes #20483.
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
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.
2018-07-24Modified RigidBody, PhysicsDirectBodyState, PhysicsServer, and their ↵Tiger Caldwell
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
2018-07-23Merge pull request #12403 from AndreaCatania/phymatJuan Linietsky
Physics material
2018-07-17Further fixes to KinematicBody2D API, support for sync motion in moving objectsJuan Linietsky
2018-07-16Changes to how snap works (I think this makes more sense now)Juan Linietsky
2018-07-16-Added support for raycast in KinematicBody2DJuan Linietsky
-Added support for snapping in KinematicBody2D