Commit graph

1195 commits

Author SHA1 Message Date
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
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
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