Commit graph

140 commits

Author SHA1 Message Date
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
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.
2020-01-01 11:16:22 +01:00
Hugo Locurcio 0a5b30b14a
Add a range property hint for the number of contacts reported
This closes #34505.
2019-12-21 22:27:10 +01:00
Marcel Admiraal 750f343e4a Ensure move_and_slide() is consistent between the 2D and 3D versions.
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-12-02 08:35:50 +01:00
Rémi Verschelde dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
luz.paz 91ecd7b6a6 Fix misc. source comment typos
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-19 14:36:52 -04:00
Rémi Verschelde 720065c721
Merge pull request #31476 from SoulForMachine/fix-move-and-slide-error
Prevent move_and_slide() to generate an error.
2019-09-03 12:51:42 +02:00
Milan Davidovic c12ce2b4dd Prevent move_and_slide() to generate an error.
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-26 15:10:15 +02:00
Rémi Verschelde bfed4b6a97
Merge pull request #31014 from DavidSichma/kinematic_angle
Fix floor_max_angle comparison for impossible angles
2019-08-23 09:10:38 +02:00
RaphaelHunter 74713fe970 Fix custom inertia in physics2d, closes#30838 2019-08-22 20:30:03 +08:00
Tomasz Chabora af5e0fff66 Remove ERR_EXPLAIN from scene/* code 2019-08-09 13:54:52 +02:00
David Sichma 2fae8832c5 Fix floor_max_angle comparison for impossible angles 2019-08-01 12:54:19 +02:00
Hugo Locurcio 0243dc53b8
Tweak Area and PhysicsBody damping setting hints for consistency
This partially addresses #19182.
2019-07-31 13:57:13 +02:00
Hugo Locurcio ff7184c5cb
Improve the node configuration warning display
- 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-07-09 00:18:00 +02:00
Bojidar Marinov 0c4c36d823
Add default values to the editor help, docs, and generated RST
Also, make spacing of "=" in the editor help a bit more consistent.
Closes #16086
2019-06-27 18:29:35 +03:00
Rémi Verschelde 6d16f2f053 Fix error macro calls not ending with semicolon
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-06-11 14:49:34 +02:00
qarmin 856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
Kanabenki 3f64215a43 Add missing check for 2d physics bounce and friction setters
The override check was already present for 3d physics but missing for 2d
2019-03-18 15:30:26 +01:00
Juan Linietsky 4f041d3afa Specifically error when users try to use sync to physics and move and slide, closes #26545 2019-03-04 09:53:02 -03:00
Juan Linietsky 9dfe3b6d9e Ensure move and slide snap respects stop on slope, fixes #26180 2019-02-23 10:24:21 -03:00
Juan Linietsky 87b303aa95 Fixed bugs in test body motion and removed unnecesary test in move_and_slide. Fixes #25968 2019-02-21 17:21:36 -03:00
Juan Linietsky 0cee7ab4c9 Change snapping to only happen when the floor normal remains as floor, fixes #22312 2019-02-16 15:50:31 -03:00
Juan Linietsky c54330c6b0 Make sure stop on slope can have a tiny bit of precision edge. 2019-02-16 11:19:47 -03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
piratesephiroth 0e94afbc92 fix stop_on_slope affecting sliding up slopes 2018-12-14 16:02:43 +01:00
DualMatrix 86472ad5a9 Fixed using move_and_slide with stop_on_slope stopping too early
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-29 02:24:33 +01:00
Juan Linietsky 0032345618 Make sure sync to physics is disabled in editor, fixes #20230 2018-11-21 22:22:43 -03:00
Rémi Verschelde 193d695a1a
Merge pull request #17530 from bojidar-bg/17516-detect-delta
Make it possible to call move_and_slide from _process, even if it is not recommended
2018-11-12 21:14:15 +01:00
Rémi Verschelde 2815e708a0
Merge pull request #23090 from DavidSichma/inconsistent-kinematic
Consistency in KinematicBody
2018-11-12 20:30:38 +01:00
Bojidar Marinov d94c76a199
Make it possible to call move_and_slide from _process, even if it is not recommended
Previously, it would reuse the _physics_process delta, causing it to move faster on faster framerates

Fixes #17516
2018-11-08 20:34:34 +02:00
Juan Linietsky f2e54057ae -Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
2018-11-08 11:30:59 -03:00
Guilherme Recchi Cardozo 3fb2069d39 Add method get_collision_exceptions
Adding this method to PhysicsBody, PhysicsBody2D and
SoftBody. It returns a list of nodes included in
collision exceptions.

Fixes #23235, cheers!
2018-11-01 06:41:34 -03:00
David Sichma 6ec4da2e3b Fix inconsistency in KinematicBody
- 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-10-17 17:22:14 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
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-12 09:52:22 +02:00
Rémi Verschelde 60570a5e60 PhysicsBody: Don't create PhysicsMaterial override for default friction/bounce
And don't save physics_material_override if null.
2018-09-02 15:08:43 +02:00
Kelly Thomas 1dc8e7c05f Improve ClassDB information for some some signal parameters 2018-09-01 18:05:51 +08:00
Rémi Verschelde 060988408b Physics: Properly obsolete friction and bounce properties
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-29 18:44:42 +02:00
Rémi Verschelde 3b01bf94ad Fix operator precedence in PhysicsBody2D::set_weight
Fixes #16038.
2018-08-29 08:37:08 +02:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Rémi Verschelde ab3716bd46 Revert "Take CanvasLayer transform into account for 2D physics"
This reverts commit 4839e5f6d9.

Fixes #21289.
2018-08-23 21:49:24 +02:00
Pedro J. Estébanez 4839e5f6d9 Take CanvasLayer transform into account for 2D physics
Fixes #18073.
2018-08-21 20:10:15 +02:00
Andrea Catania 0010d9c82a Added ray shape and move_and_slide with snapping on 3D.
Added stop_on_slope on 2d part
2018-08-19 13:45:23 +02:00
Juan Linietsky c02fb271fd apply a threshold for floor angle, fixes #16037, fixes #15632 2018-08-10 13:07:52 -03:00
Juan Linietsky 14fd797c53
Merge pull request #20381 from AndreaCatania/phymat_2
Improved Physics material
2018-08-07 15:31:26 -03:00
Andrea Catania 5e65e28eed Removed physics material combination mode. Added rough and absorbent parameter to material. Fixed 'change' signal connection 2018-08-07 19:38:04 +02:00
Rémi Verschelde 12254594ac Fix PhysicsBody build with deprecated=no
Fixes #20483.
2018-07-27 15:34:58 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
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-26 00:54:16 +02:00
Tiger Caldwell 40c7716586 Modified RigidBody, PhysicsDirectBodyState, PhysicsServer, and their 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-24 05:00:56 -04:00
Juan Linietsky 1ad20dc2f1
Merge pull request #12403 from AndreaCatania/phymat
Physics material
2018-07-23 07:37:03 -03:00
Juan Linietsky 13a801430b Further fixes to KinematicBody2D API, support for sync motion in moving objects 2018-07-17 08:58:04 -03:00