Commit graph

1367 commits

Author SHA1 Message Date
smix8
3aa05b7b67 [3.5] Fix TileMap texture offset for navigationmesh and collisionshapes
[3.5] Fix TileMap texture offset for navigationmesh and collisionshapes
2022-06-08 19:30:52 +02:00
smix8
8df9fd076f Process NavigationAgent2D/3D avoidance on demand only
Changes NavigationAgent avoidance callback to a toggle that is disabled by default.
Also fixes a few missing descriptions / wrong warnings.

(cherry picked from commit 7f3688603c)
2022-05-22 19:43:56 +02:00
smix8
88acb5b798 Make Navigation Agents and Obstacles respect parent process mode
Temporarily removes agent from navigation map when parent node cannot process due to SceneTree pause and process_mode property. Normal process_mode does not work as other agents would still avoid the paused agents because they were still active on the navigation map and the rvo world. Also fixes potential crash when region_get_map or agent_get_map is called while no map is set.

(cherry picked from commit 6b51ab66d8)
2022-05-19 15:34:56 +02:00
Haoyu Qiu
b657d0c76c Add dedicated macros for property name extraction
* Replace case-by-case extraction with PNAME & GNAME
* Fix group handling when group hint begins with property name
* Exclude properties that are PROPERTY_USAGE_NOEDITOR
2022-05-19 11:31:35 +08:00
Rémi Verschelde
b0a2b34d48
Merge pull request #61150 from smix8/navigation_region2d_update_navpoly_3.x 2022-05-18 14:36:55 +02:00
smix8
37530b0871 Update NavigationPolygonInstance when polygons of NavigationPolygon change
Updates NavigationPolygonInstance polygons on the NavigationServer2D when the NavigationPolygon Resource emits its changed signal due to e.g. polygons altered by script.
2022-05-18 13:53:46 +02:00
Haoyu Qiu
96b1b1991b Fix AnimatedSprite doesn't emit animation_finished when changing playback direction
(cherry picked from commit d5f5e96e11)
2022-05-16 21:12:21 +02:00
smix8
b11708c50d Expose NavigationObstacle2D/3D get_rid() and add config warning
Exposes get_rid() function for scripting.
Adds configuration warning when obstacle is used with not intended static body parent.

(cherry picked from commit 001d89223f)
2022-05-16 17:52:07 +02:00
smix8
847fab6272 Fix NavigationObstacle2D/3D get_global_transform() error
Fixes NavigationObstacle2D/3D reporting a 'get_global_transform: Condition "!is_inside_tree()" error when estimating the agent radius.

The collisionshapes that are lower in the SceneTree order than the obstacle node are not loaded in the SceneTree yet so the global_transform function fails.

Also adds warning message when this happens.

(cherry picked from commit cc707412e9)
2022-05-16 17:52:07 +02:00
kobewi
bdbbc78da4 Mention that Area2D doesn't support one_way_collision
(cherry picked from commit c836bdf5b1)
2022-05-16 16:27:51 +02:00
Haoyu Qiu
0f7f3d08ba Add autocompletion for AnimatedSprite.play() 2022-05-05 09:04:40 +08:00
Rémi Verschelde
8835654578 Merge pull request #60656 from akien-mga/tilemap-methods-const-ref-vector2 2022-05-02 09:51:51 +02:00
smix8
ebcbbec563 Add get_region_rid() to NavigationPolygonInstance and NavigationMeshInstance
Add get_region_rid() to NavigationPolygonInstance and NavigationMeshInstance
2022-04-30 15:54:12 +02:00
Rémi Verschelde
2834332591 TileMap: Use const ref for all Vector2 parameters 2022-04-30 14:05:57 +02:00
Rémi Verschelde
841d6e7fad
Merge pull request #59439 from fabriceci/3x-fix-move-and-collide-reported-collisions 2022-04-28 18:47:28 +02:00
Haoyu Qiu
f33dec8084 Improve RayCast2D debug shape
Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2022-04-20 17:28:35 +08:00
kobewi
73248ccf89 Fix TouchScreenButton error spam
(cherry picked from commit db19cc60fb)
2022-04-13 11:43:49 +02:00
Haoyu Qiu
5c039ccc72 Free region RID when cleaning NavPoly in TileMap 2022-04-08 19:19:09 +08:00
Ricardo Buring
21580f94ad NavigationObstacle2D: estimate agent radius only when configured to do so 2022-04-03 22:11:44 +02:00
Pedro J. Estébanez
9e2d5120c1 Fix crash when passing null to AudioStreamPlayer::set_stream() 2022-04-03 12:52:17 +02:00
Rémi Verschelde
5c0dccace9
Merge pull request #59413 from ellenhp/preinstance-audio-streams 2022-03-31 18:49:05 +02:00
Ellen Poe
027546ee8a [3.x] instance audio streams before AudioServer::lock call 2022-03-31 08:48:36 -07:00
Haoyu Qiu
b89befe173 Fix crash when using Camera2D::set_custom_viewport() 2022-03-31 16:42:14 +08:00
FireForge
7f787857ef Fix inspector group name capitalization
(cherry picked from commit 88b09694e7)
2022-03-29 00:20:23 +02:00
fabriceci
65b3200a16 Fix wrong collision reported on move_and_collide 2022-03-23 11:39:54 +01:00
Jason Knight
09e4672f0d Bind NOTIFICATION_LOCAL_TRANFORM_CHANGED 2022-03-20 11:34:29 -06:00
Haoyu Qiu
b76147ec16 Fix top level CanvasItem visibility
The editor gizmo fix from previously reverted
642591b6a9 is kept here.
2022-03-08 01:29:24 +08:00
Haoyu Qiu
d0901d4d55 Revert backport of "Rework CanvasItem visibility propagation"
This reverts part of commit f49ffe4bb0
2022-03-08 01:17:52 +08:00
Haoyu Qiu
ba0a17a458 Revert "Fix CanvasItem visibility propagation"
This reverts commit 642591b6a9.
2022-03-08 01:06:14 +08:00
Haoyu Qiu
7e07d4781a Fix AnimatedSprite infinite loop
(cherry picked from commit 3a439a9c03)
2022-03-02 11:00:26 +01:00
Ricardo Buring
322e3a9567 Joint2D and Joint: make set_exclude_nodes_from_collision respect signals 2022-02-28 22:51:40 +01:00
Ricardo Buring
f197e5eebb Joint2D and Joint: update joint on NOTIFICATION_POST_ENTER_TREE
This allows reparenting, etc.
2022-02-28 22:48:48 +01:00
kobewi
642591b6a9 Fix CanvasItem visibility propagation 2022-02-21 11:11:03 +01:00
Haoyu Qiu
85be83ebbb Fix typo in CanvasItem visibility propagation backport 2022-02-18 19:12:29 +08:00
Hugo Locurcio
ac0d37dcef
Add a property hint for the Line2D Round Precision property
This prevents choosing extremely high values which cause performance
issues for no visual benefit.

(cherry picked from commit 6b52aa67b8)
2022-02-17 09:59:28 +01:00
Haoyu Qiu
f49ffe4bb0 Backport CanvasLayer visibility 2022-02-11 01:00:35 +08:00
Haoyu Qiu
74a4795fb1 Fix RayCast{,2D}.clear_exceptions clears parent 2022-02-08 16:22:10 +08:00
lawnjelly
a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
Rémi Verschelde
9cdd110cc3
Merge pull request #56600 from Scony/fix-navigation-obstacle-errors-3.x 2022-01-28 23:18:57 +01:00
Fitch24
c6890c6d12 Fix "mass" and "weight" properties of the RigidBody (and RigidBody2D) in the Inspector view 2022-01-27 19:58:51 +07:00
Haoyu Qiu
fa96505418 Store ObjectID instead of raw pointer for Shape Owners 2022-01-25 17:16:02 +08:00
Pawel Lampe
67cf622935 Improve Navigation2D default settings, fixes #56852
This commit reduces `cell_size` and `edge_connection_margin` default
values so that `Navigation2D` behaves more like in Godot <= `3.4` by default.
2022-01-23 14:07:31 +01:00
Rémi Verschelde
40a348bce2
Merge pull request #57013 from Killfrra/3.x
[3.x] Backport method `get_rid` for NavigationAgent
2022-01-21 18:35:19 +01:00
Mak Kma
1c3d3af6ef backported method get_rid for NavigationAgent 2022-01-21 00:15:16 +03:00
lawnjelly
adf14bfdde Add nodiscard to core math classes to catch c++ errors.
A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
2022-01-20 17:28:31 +00:00
Rémi Verschelde
e00a6d2b71
Merge pull request #56748 from albinaask/Fix-for-#56324 2022-01-13 17:05:16 +01:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Albin
21ca1c9cd7 Fixed a number of ",or_greater" for the bug #56324
fix to #56324

Note: CPU_Particles_2d is missing ring emitter
2022-01-13 11:51:24 +01:00
Anilforextra
3fad43acad
Path2D: Check points count before rendering.
(cherry picked from commit b770a4d0ac)
2022-01-12 17:34:21 +01:00
Arnav Vijaywargiya
a51f3f2a58
Fixed incorrect property types
(cherry picked from commit 0c46f73b5e)
2022-01-12 17:28:07 +01:00
Rémi Verschelde
1b0ba42ea1
Merge pull request #55268 from Calinou/gpu-particles-macos-performance-warning 2022-01-12 16:51:31 +01:00
Rémi Verschelde
7249e170f7
Merge pull request #56044 from timothyqiu/position-nodes
[3.x] Improve axis awareness and visibility for Position2D and Position3D
2022-01-11 08:54:52 +01:00
Pawel Lampe
6093d59b17 Fix NavigationObstacle errors
* Typo in error print leading to false-positive message
* `NavigationObstacle` premature radius estimation (before entering the tree)
* `NavigationObstacle2D` premature radius estimation (before entering the tree)
2022-01-07 20:04:19 +01:00
Rémi Verschelde
02d9ac1071
i18n: Sync template with current 3.x codebase
Weblate will now track the state of `3.x` to prepare for the 3.5 release.
2022-01-07 13:30:21 +01:00
fabriceci
10e63b8dd6 backport moving_platform_apply_velocity_on_leave 2022-01-07 12:54:49 +01:00
Haoyu Qiu
e97cae86b8 Add missing break in NavigationObstacle2D 2022-01-06 21:23:53 +08:00
Wilson E. Alvarez
4106f95f30
Expose autotile_coord parameter in TileMap.set_cellv 2022-01-05 21:24:35 -05:00
Hugo Locurcio
299d277c9c
Warn when using GPU-based particles on macOS due to low performance
On macOS, Particles rendering is much slower than CPUParticles
due to transform feedback being implemented on the CPU instead
of the GPU.
2022-01-06 00:10:32 +01:00
Jake Young
09bc9eb101
Backport NavigationServer with RVO2 to 3.x
Change the entire navigation system.
Remove editor prefix from nav mesh generator class. It is now used for baking
at runtime as well.
Navigation supports obstacle avoidance now with the RVO2 library.
Nav system will also automatically link all nav meshes together to form one
overall complete nav map.
2022-01-05 16:00:56 +01:00
Haoyu Qiu
2bff705e13 Improve axis awareness and visibility for Position2D and Position3D
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-12-18 12:53:24 +08:00
Anilforextra
9351bc4b1c
Fixed awkwardly named AnimatedSprite Setters.
(cherry picked from commit 0c06ed98fb)
2021-12-10 17:57:39 +01:00
Raffaele Picca
6dd593d579 Random initial color for all Particle Nodes 2021-12-10 16:35:25 +01:00
Rémi Verschelde
e82091db51
Merge pull request #55782 from RPicster/3.x-gpu-particle-vis-rect 2021-12-10 13:50:45 +01:00
Raffaele Picca
995408b492 GPU Particles (2D + 3D) visibility rect / gizmo optimization for reduced visual clutter 2021-12-10 11:22:44 +01:00
Rémi Verschelde
76ab82526a
Merge pull request #54650 from tinmanjuggernaut/fix_rid 2021-12-09 22:00:24 +01:00
Raffaele Picca
28a6d32971 Fixed texture animation speed when using random lifetime 2021-12-09 19:59:24 +01:00
Cory Petkovsek
3d20218dae Clears RIDs wherever they are freed by VisualServer or PhysicsServer and possibly reused. Fixes #53374 2021-12-10 02:31:30 +08:00
lawnjelly
3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Rémi Verschelde
3be0f85e91
Merge pull request #54377 from lawnjelly/faster_editor_lines 2021-11-30 13:30:02 +01:00
Eric
850ee9d4a2
Fix condition on 'jump to limits' logic
This is a fix for: #54856

(cherry picked from commit 7257bb6ad0)
2021-11-29 16:14:04 +01:00
Rémi Verschelde
86fd7da7a3
Merge pull request #54899 from clayjohn/MultiMesh-update 2021-11-22 08:30:49 +01:00
clayjohn
b54d4a93be Update CanvasItem when MultiMesh instance transform changes 2021-11-21 12:27:22 -08:00
Marcel Admiraal
4d3690eba5 Remove unimplemented methods 2021-11-18 12:47:36 +00:00
BrunoSXS
8fd0fe3d20
Fixes a game crash caused by instantiating Camera2D and sending a notification from it before adding it to the tree.
(cherry picked from commit eb2deabffe)
2021-11-18 12:21:28 +01:00
Rémi Verschelde
6c0afa470e
Merge pull request #54435 from robfram/hidden-tile-map-light-occlusion 2021-11-15 23:29:04 +01:00
PouleyKetchoupp
1560c8b5aa Fix test_move reporting collision when touching another body
Reporting rest collision information is needed for move_and_collide and
move_and_slide so floor detection can be done properly, but in the case
of just testing the motion for collision, it makes sense to return false
if the body is able to move all along the path without being stopped.

Updated the logic in test_move and clarified the documentation for
test_move and move_and_collide.
2021-11-10 11:07:32 -07:00
PouleyKetchoupp
b93aeec4a2 Fix errors in KinematicBody when floor is destroyed or removed
In all physics servers, body_get_direct_state() now silently returns
nullptr when the body has been already freed or is removed from space,
so the client code can detect this state and invalidate the body rid.

In 2D, there is no change in behavior (just no more errors).

In 3D, the Bullet server returned a valid direct body state when the
body was removed from the physics space, but in this case it didn't
make sense to use the information from the body state.
2021-11-09 15:15:40 -07:00
Pedro J. Estébanez
4dba25b3ff Add property value pinning 2021-11-08 17:42:27 +01:00
PouleyKetchoupp
ec0dc93083
Fix errors with invalid bone node path in Polygon2D
NodePath properties are designed to be relative to the given node, so
validity checks are failing in the editor for Polygon2D nodes, which are
relative to the Skeleton2D node rather than the Polygon2D node.

Fixed by saving bone paths as String properties instead of NodePath.

Shouldn't cause a difference for performance since NodePath properties
are technically saved as String anyway.

(cherry picked from commit 8d9619ad46)
2021-11-03 17:31:10 +01:00
robfram
cf9220b7d5 Only visible TileMaps should add light occluders 2021-10-30 23:15:07 +02:00
lawnjelly
ab76cd6ff2 Faster editor line drawing - Path2D and draw_line
Changes the Path2D drawing to use POLYLINE instead of thick lines.
Add a path to translate thick lines (that are not using anti-aliasing) to draw as polygons instead. This should be faster because polygons can be batched.
2021-10-29 12:40:24 +01:00
Rémi Verschelde
14ef65e49b
Merge pull request #54348 from akien-mga/3.x-clang-format-dont-align-operands 2021-10-28 15:43:15 +02:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Rémi Verschelde
187f293189
Merge pull request #54154 from bjauny/fix_areanotification 2021-10-27 20:38:55 +02:00
Bastien JAUNY
a6ca61797c Checking validity of world reference before using it. Fix #54094. 2021-10-27 19:32:44 +02:00
Zae
a1b282cc16
Fix unexpected crashes in notification
(cherry picked from commit 924c2078da)
2021-10-25 11:16:59 +02:00
Kemikal1
fa2feb9bec
Change the unreacheable return value of shape_find_owner()
(cherry picked from commit 563d3dbf94)
2021-10-23 11:57:10 +02:00
kobewi
f0dabe4ac5
Fix MeshInstance2D rect
(cherry picked from commit 1a347e9cf3)
2021-10-23 11:54:55 +02:00
Hugo Locurcio
c4a3560884
Allow negative scale in Particles and CPUParticles
This can be used to make 2D particles look more 3D-y with thoughtful use
of scale curve animation.
2021-10-15 19:06:30 +02:00
Maxime Lapointe
f3002c62b7 Improve area/body_shape_entered/exited signals parameter names and doc
Fix some typoed names from the doc
Add _index to "index" parameters of *_shape_* signals, this is both in doc and in the template. This makes the code, signature and doc easier to understand
Add method to get Node from the _index params of those signals. This was not as easy to find as one would expect. Putting this information where it is needed will help.
2021-10-15 11:28:17 -04:00
Haoyu Qiu
0f18f225ee Fix crash when deleting Camera2D and Viewport assigned to it 2021-10-06 13:41:21 +08:00
Rémi Verschelde
bd7bea2087
Merge pull request #53233 from metinc/fix-animated-sprite-precision-error 2021-10-05 15:23:51 +02:00
kobewi
f9720a9bf2 Add Listener2D 2021-10-05 13:29:59 +02:00
kleonc
e2e149f4df Fix rendering centered odd-size texture in AnimatedSprite/AnimatedSprite3D 2021-10-03 14:15:21 +02:00
Metin Celik
edcb7b8129 Add half frame to floor() 2021-09-29 20:03:07 +02:00
Laurenz Reinthaler
aad01cd0c6 Fix VisibilityEnabler2D throwing a signal error when process_parent or physics_process_parent are enabled 2021-09-24 19:03:10 +02:00
PouleyKetchoupp
8b562543df Don't override KinematicCollision reference when still in use in script
In case the reference is stored in script, create a new instance to
avoid overriding the previous values.
Otherwise, re-use the reference as before to avoid extra allocations.
2021-09-22 18:15:03 -07:00
PouleyKetchoupp
ad5e70cde4 Fix moving platforms with ray shapes
In the case of ray shapes, the body RID used to apply platform velocity
wasn't properly set.
2021-09-21 09:00:23 -07:00
Tom Coxon
9e9bac1549 Prevent shaders from generating code before the constructor finishes.
Fixes #43733: "creating SpatialMaterial in a separate thread creates invalid
shaders (temporarily)."

The bug occurred because various setters called in materials' constructors add
materials to queues that are processed on the main thread. This means that
when the materials are created in another thread, they can be processed on the
main thread before the constructor has finished.

The fix adds a flag to affected materials that prevents them from being added
to the queue until their constructors have finished initialising all the
members.
2021-09-21 11:47:51 +01:00
Haoyu Qiu
5183c473f7 Backport new methods for KinematicBody and KinematicCollision
For both 2D and 3D, three methods are added:

- `get_floor_angle` on `KinematicBody` to get the floor angle.
- `get_angle` on `KinematicCollision` to get the collision angle.
- `get_last_slide_collision` to quickly get the latest collision of `move_and_slide`.
2021-08-26 12:16:40 +08:00
fabriceci
13d5fa2c43 Remove the transmission of velocity when a body is on_wall 2021-08-24 11:29:40 +02:00
Rémi Verschelde
6a058cbf39
Merge pull request #51746 from Calinou/add-shader-comment-3.x
Add a comment at the top of generated shaders (3.x)
2021-08-19 00:16:29 +02:00
PouleyKetchoupp
be13538b71 Fix 3D character snap on moving platforms
Applying the platform velocity when leaving the platform floor should be
done after snapping to keep things consistent.

Now it's done in both 2D and 3D, as it's already done in 2D on master.
2021-08-16 11:30:28 -07:00
Rémi Verschelde
dc1b18e832
Merge pull request #51743 from fabriceci/3x-avoid-useless-snap
[3.x] Avoid useless call to move and collide during snapping
2021-08-16 20:19:39 +02:00
Hugo Locurcio
8dae2f9f00
Add a comment at the top of generated shaders
This comment is useful to determine the origin of ShaderMaterials
converted from built-in material types (such as CanvasItemMaterial
or SpatialMaterial).

The Godot version is also included in case the shader needs to be
regenerated with a newer engine version.
2021-08-16 18:46:55 +02:00
fabriceci
2cb364bab1 Avoid to snap when the body is already on the floor. 2021-08-16 18:09:44 +02:00
Anilforextra
081bc20d66
Remove unused swap template.
(cherry picked from commit e3872a244d)
2021-08-12 16:46:02 +02:00
Rémi Verschelde
1cd10461ca
Merge pull request #50351 from JestemStefan/node_2D_zero_scale_det_bug
[3.x] Limit scale of `Node2D` to EPSILON (0.00001) to prevent det==0 error
2021-08-12 15:41:04 +02:00
PouleyKetchoupp
da159cd258 Fix 3D moving platform logic
Same thing that was already done in 2D, applies moving platform motion
by using a call to move_and_collide that excludes the platform itself,
instead of making it part of the body motion.

Helps with handling walls and slopes correctly when the character walks
on the moving platform.

Also made some minor adjustments to the 2D version and documentation.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-08-09 18:55:49 -07:00
Rémi Verschelde
0403cb8ad5
Merge pull request #51447 from nekomatata/fix-moving-platform-rotation-3.x
[3.x] Fix applied rotation from moving platforms in move_and_slide
2021-08-09 23:20:35 +02:00
PouleyKetchoupp
f101349225 Fix applied rotation from moving platforms in move_and_slide
When synchronizing KinematicBody motion with moving the platform using
direct body state, only the linear velocity was taken into account.

This change exposes velocity at local point in direct body state and
uses it in move_and_slide to get the proper velocity that includes
rotations.
2021-08-09 12:04:57 -07:00
kleonc
2eeed26d67 TileMap Fix trying to get data for tile not existing in attached TileSet 2021-08-06 18:52:04 +02:00
vitika9
bea67d7763
Fixed Camera2D's reset_smoothing() does not work as described
(cherry picked from commit 22eaec6895)
2021-08-03 09:15:33 +02:00
Rémi Verschelde
56d7de2208
Merge pull request #50909 from fabriceci/fix-multiple-direction-collision-3x
[3.x] Allow multiple collision direction at the same time
2021-07-27 19:10:52 +02:00
Haoyu Qiu
eb31a39e82
Add check to internal methods to prevent crash
(cherry picked from commit 448295cd51)
2021-07-27 12:17:14 +02:00
fabriceci
aaf09f864a Allow multiple collision direction at the same time 2021-07-26 20:11:22 +02:00
Rémi Verschelde
e3c545668b
Merge pull request #50112 from lawnjelly/camera_2d_current
Most recently added current Camera2D takes precedence
2021-07-22 12:16:44 +02:00
PouleyKetchoupp
beeebb4c2f More accurate unsafe motion calculation
* Safe and unsafe motion are calculated by dichotomy with a limited
number of steps. It's good for performance, but on long motions that
either collide near the beginning or near the end, the result can be
very imprecise.
* Now a factor 0.25 or 0.75 is used to converge faster when this case
happens, which allows longer motions to get more accurate collision
detection.
* Makes snap collision more precise, and helps with cases where diagonal collision on the border of a platform can lead to the character being stuck.

Additional improvements to move_and_slide:
* Handle slide canceling in move_and_collide with 0 velocity instead of
not applying it.
* Better handling of snap with custom logic to cancel sliding.
* Remove small jittering when using stop on slope, by canceling the
motion completely when the resulting motion is less than margin instead
of always projecting to the up direction (in both body motion and snap).

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:17 -07:00
PouleyKetchoupp
2fbb6fff4e Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is
higher than the margin, which means the body needs depenetration in any
direction.

Also changed move_and_slide to avoid sliding on the first motion, in
order to avoid issues with unstable position on ground when jumping.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:16 -07:00
Rémi Verschelde
231efe0c6d
Merge pull request #50166 from fabriceci/fix-2d-moving-platform
[3.x] Fixing 2D moving platform logic
2021-07-15 13:34:30 +02:00
fabriceci
fba4c9d552 Fixing 2D moving platform logic
Fixing by applying the movement in two steps, first the platform
movement, and then the body movement. Plus, add the platform movement
when we are on_wall.
2021-07-15 11:57:58 +02:00
Hendrik Brucker
fe616d443a
Fix color properties of particle nodes/material
(cherry picked from commit 3a4a2198ed)
2021-07-15 10:25:35 +02:00
JestemStefan
b7817c7b59 Added minimum scale for node 2D 2021-07-12 12:15:33 +02:00
Eric
09b231e15f
Enable Camera2D smoothing on limit change
(cherry picked from commit 525ad7c37e)
2021-07-06 11:10:35 +02:00
lawnjelly
21a24eb959 Most recently added current Camera2D takes precedence
The situation when multiple current Camera2Ds were in the scene was not dealt with. This could leave several cameras with their current bool set, and each competing to update the viewport scroll, in a random / accidental fashion.

This PR standardises the rule that the most recent current Camera2D added to the scene tree takes over the current status, and sets all other current cameras in the scene tree to non-current. This makes the bools correct, and also prevents the competition over viewport scroll.
2021-07-03 08:58:20 +01:00
Rafał Mikrut
cb5faca39a
Prevent setting too big or too small Collision Mask and Layer 2021-06-27 17:40:07 +02:00
Rémi Verschelde
fc95c4d84c
Merge pull request #49476 from nekomatata/kinematic-collision-rid-3.x
[3.x] Expose collider RID in 2D/3D kinematic collision
2021-06-18 12:32:42 +02:00
Marcel Admiraal
5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
PouleyKetchoupp
a146e79758 Expose collider RID in 2D/3D kinematic collision
Can be useful to access the colliding body information for bodies
created with the physics server directly.
2021-06-09 18:26:16 -07:00
Hugo Locurcio
e0facdaf61
Uncap the range for gravity and change the slider hints
There's not really a reason to cap the gravity amount, and we can also
give better hints for the range (for 3D, ±32 is much more sensible
than ±1024).
2021-06-03 02:08:57 +02:00
Hugo Locurcio
93d157d213
Tweak Camera2D editor line colors for better visibility
The new color for screen drawing was chosen to be easier to distinguish
from the 2D viewport limits.

This also makes lines less opaque when the Camera2D has the Current
property enabled. The increased line width is enough to spot the
camera easily, and the increased opacity on top of that felt obnoxious.

(cherry picked from commit 8e2a7fff1d)
2021-06-01 12:53:30 +02:00
Rémi Verschelde
00abdaf333
Merge pull request #49075 from nekomatata/tilemap-collision-debug-fix-3.x
Fix logic for showing tilemap debug collision
2021-05-25 21:12:48 +02:00
PouleyKetchoupp
114da550ec Fix logic for showing tilemap debug collision
In editor: only when show_collision property is enabled
In game: only when 'Visible collision shapes' is enabled
2021-05-25 11:49:47 -07:00
Marcel Admiraal
09456c2a01 Return RID instead of Object id in area-body_shape_entered-exited signals. 2021-05-19 10:51:59 +01:00
kleonc
1184013fcf
TileMap::world_to_map Ensure half offset is added according to the returned value
Decide whether half offset should be added based on the value used for calculating the return value of this method.

(cherry picked from commit f1420c7cbf)
2021-05-09 17:15:44 +02:00
Marcel Admiraal
8766769fd4 Move collision layer and mask into CollisionObject. 2021-05-08 11:40:57 +01:00
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
b4af1eba0a
Style: Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-05-04 16:39:13 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde
70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Lightning_A
e4addffde1
Put physics override parameters in their own group and document that areas can be used to influence audio
(cherry picked from commit 80b1a29c46)
2021-04-29 12:27:31 +02:00
Rafał Mikrut
06976c3e84 [3.x] Fix crashes when using _input functions 2021-04-27 16:51:29 +02:00
rafallus
e075b6b411 Check if _direct_state_changed() argument is valid
- Modified classes: RigidBody, PhysicalBone, VehicleBody, RigidBody2D, KinematicBody2D
- The input argument is untrusted even in release mode
2021-04-07 20:00:30 -05:00
Rémi Verschelde
822b734601
Re-allow playing AnimatedSprite2D without frames
Fixes #47578, partial revert of #47064.

(cherry picked from commit 77264e346b)
2021-04-05 15:01:01 +02:00
Rémi Verschelde
54f0d8cf96
Merge pull request #47533 from qarmin/fix_navigation
[3.x] Validate argument in Navigation2D::navpoly_add
2021-03-31 20:29:45 +02:00
Rafał Mikrut
050edac8e0 Validate argument in Navigation2D::navpoly_add 2021-03-31 20:10:51 +02:00