127 Commits

Author SHA1 Message Date
Thaddeus Crews 70dcb2aa84 Merge pull request #118155 from mihe/jolt/motion-contact-filtering
Move the Jolt `body_test_motion` contact filtering to collector
2026-05-11 17:11:31 -05:00
Mikael Hermansson 860b774db0 Fix Jolt integration not converting planes correctly 2026-04-25 13:30:12 +02:00
Thaddeus Crews 653fed37e0 Merge pull request #118291 from mihe/jolt/fix-gravity
Fix gravity not being initialized properly when using Jolt
2026-04-07 18:21:54 -05:00
Mikael Hermansson 89c022813e Fix gravity not being initialized properly when using Jolt 2026-04-08 00:48:41 +02:00
Mikael Hermansson 7f6796a572 Fix over-removal of area overlaps when using Jolt 2026-04-07 18:48:18 +02:00
Mikael Hermansson 64cf02362a Jolt: Update RigidBody3D environmental properties more appropriately 2026-04-05 17:41:15 +02:00
Mikael Hermansson cad048c368 Move the Jolt body_test_motion contact filtering to collector
Co-authored-by: Jorrit Rouwe <jrouwe@gmail.com>
2026-04-03 17:31:32 +02:00
Thaddeus Crews 0e8bd28a10 CI: Implement clangd-tidy as GitHub Action 2026-03-20 09:16:38 -05:00
Rémi Verschelde 7a99a2c782 Jolt: Use angled brackets for thirdparty includes
That's how we usually include thirdparty code, and it solves warnings
from clangd/IWYU about some Jolt headers (notably `Jolt/Jolt.h`) not being
used directly but as proxies to transitive includes.
2026-03-16 16:40:40 +01:00
Rémi Verschelde 6d309c858e Remove unused includes in modules with clangd-tidy 2026-03-16 16:40:39 +01:00
Jorrit Rouwe ff59dd6d5a Increased maximum value of HeightFieldShape::mBitsPerSample to 16 to allow for better precision
Made tolerance that's used in the internal edge removal algorithm configurable in CollideShapeSettings and PhysicsSettings
2026-03-09 12:59:20 +01:00
Rémi Verschelde eabb9a63d4 Rename callable_method_pointer.h to callable_mp.h and include it explicitly
This allows removing it from `class_db.h`, significantly reducing the amount of files
that include it transitively.

Also includes some include cleanup in `control.h` and `rich_text_label.h` done while
ensure they don't depend on `callable_mp`.
2026-03-04 16:23:23 +01:00
Rémi Verschelde 727b06a79f Move ProcessID typedef out of OS
This allows decoupling a number of files from `os.h`.
2026-03-04 15:00:45 +01:00
Rémi Verschelde 8c0f175c94 Decouple RenderingServer from as much of the codebase as possible
Notably decouples it from:
- AccessibilityServer
- DisplayServer
- Viewport
- Window
2026-03-03 12:48:07 +01:00
StarryWorm 357fa00a4a rm class_db.h from resource.h 2026-02-27 19:08:29 -05:00
Thaddeus Crews 5a5a806eaf Merge pull request #116768 from mihe/jolt/tidying-up
Tidy some things up in `modules/jolt_physics`
2026-02-26 08:15:17 -06:00
Rémi Verschelde f5a290ac46 Move RenderingServer enums to a dedicated RenderingServerEnums (RSE) namespace
A number of headers in the codebase included `rendering_server.h` just for
some enum definitions. This means that any change to `rendering_server.h` or
one of its dependencies would trigger a massive incremental rebuild.

With this change, we decouple a number of classes from `rendering_server.h`,
greatly speeding up incremental rebuilds for that area.

On my machine, this reduces incremental compilation time after an edit of
`rendering_server.h` by 60s (from 2m57s).
2026-02-25 19:43:03 +01:00
Mikael Hermansson 72494ba3bc Tidy some things up in modules/jolt_physics 2026-02-25 17:39:37 +01:00
Mikael Hermansson 371485758a Share one JoltTempAllocator instance across all JoltSpace3D 2026-02-25 17:16:20 +01:00
Mikael Hermansson 1c16c4fdcc Add ability for Area3D to detect/influence SoftBody3D with Jolt Physics
Co-authored-by: Jorrit Rouwe <jrouwe@gmail.com>
2026-02-12 16:30:05 +01:00
Jorrit Rouwe 8a6d125ec2 Jolt Soft Body: Make default mass 1 kg and fix stiffness conversion
Before this change, the default SoftBody3D mass was 0 which would set the mass of every vertex to 1 kg. The SoftBody3D UI in this case shows 0.001 kg, while for a cloth with a reasonable number of subdivisions the actual weight would be in the order of 1000 kg. This weight is likely to be much more than the weight of other RigidBody3D's in the scene (their default weight is 1) causing unrealistic interactions.

* Changed the default mass for a soft body to 1 kg, this mass is distributed uniformly across all soft body vertices. This matches what Godot Physics does.
* Added a missing call to _update_mass() so that calling set_mass after creation actually updates the mass now.
* Added an error check to set_mass() so that it no longer accepts zero mass as input.
* Fixed the conversion from godot stiffness to Jolt's compliance with a formula that was derived from the XPBD vs PBD equations. The previous conversion routine was determined experimentally and did not account for vertex mass. This meant that when the vertex mass became really low, the simulation became unstable.
2026-02-08 10:38:46 +01:00
Lukas Tenbrink c5df0cb82b Don't right-align escaped newlines, e.g. for #define. This has previously led to long diffs in the commit history. 2026-02-04 19:31:28 +01:00
Rémi Verschelde 429750f60b Merge pull request #115093 from Ivorforce/hashmap-explicit-copy
Change copy constructors of `HashMap` and `AHashMap` from implicit to explicit
2026-01-31 22:50:51 +01:00
Thaddeus Crews 657d06a8f3 Merge pull request #115305 from jrouwe/115169_v3
Jolt Physics: Rework how gravity is applied to dynamic bodies to prevent energy increase on elastic collisions
2026-01-26 15:01:56 -06:00
Mikael Hermansson e7cf2f42cc Fix transform updates sometimes being discarded when using Jolt
Co-authored-by: Jorrit Rouwe <jrouwe@gmail.com>
2026-01-25 16:44:08 +01:00
Jorrit Rouwe be27d23116 Jolt Physics: Reworked how gravity is applied to dynamic bodies to prevent energy increase on elastic collisions 2026-01-23 20:08:05 +01:00
Lukas Tenbrink 1825e89787 Change copy constructors of HashMap and AHashMap from implicit to explicit. 2026-01-21 13:01:23 +01:00
Mikael Hermansson 7efdb83924 Remove call to PhysicsServer3D from Jolt Physics implementation 2025-12-05 13:52:42 +01:00
David Snopek 308f23f21d Synchronize the names for RequiredParam<T> arguments in header files 2025-12-03 04:14:52 -06:00
David Snopek fc92ce3e7f Use RequiredParam/RequiredResult in some high value places 2025-12-02 10:44:12 -06:00
Jorrit Rouwe 6141e1dcc8 Jolt Physics: Remove sharing shared soft body settings from SoftBody3D
Since the soft body meshes are always copied before simulation, the shared map never actually shared data with anything. This also makes it possible to create the mesh in local space the 2nd time it gets added to a space.

This fixes the following 2 problems:
* Inertia calculation becomes inaccurate when the vertices are far away from the origin. This triggered a harmless assert on 2nd insert.
* The pressure calculations become inaccurate when the vertices are far away from the origin. Since we update the soft body position to the center of mass of all vertices at the end of every physics update, this problem lasted only for a single frame after reinserting and could cause a little jolt.
2025-11-11 21:19:48 +01:00
Jorrit Rouwe 7be272e24a SoftBody3D's position influences its physics in Jolt
The position of a soft body was always kept at identity. This introduced computational errors when moving the soft body away from the origin. Translation is now stored in the soft body's position rather than in its vertices.

Fixes #112348
2025-11-07 21:21:41 +01:00
Robert Yevdokimov f7b7c0827b Jolt: Add null checks to jolt_free and jolt_aligned_free 2025-11-04 08:43:55 -06:00
Mikael Hermansson cf75064c71 Jolt: Update to 5.4.0 2025-10-07 13:43:40 +02:00
Rémi Verschelde 9052d31c68 Merge pull request #111331 from Repiteo/scons/revert-cppextpath
Revert "SCons: Add `CPPEXTPATH` for external includes"
2025-10-07 13:07:19 +02:00
Thaddeus Crews b17aa3343a Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
Thaddeus Crews 5935a32e32 Core: Cleanup headers in core/config
- `MainLoop` now forward-declared in `OS`
2025-10-06 09:20:56 -05:00
Thaddeus Crews 3b04c8464c Merge pull request #107273 from DexterFstone/add-game-speed-controls
Add game speed controls to the embedded game window
2025-10-06 09:06:24 -05:00
DexterFstone 7ddce8ab26 Add game speed controls to the embedded game window 2025-10-05 11:13:15 +05:30
Aaron Franke 3d1c9fd5de Move server files into their subfolders 2025-09-30 19:39:39 -07:00
Thaddeus Crews d705613db3 Merge pull request #110964 from mihe/jolt/invalid-test-motion
Fix crash when calling `move_and_collide` with a null `jolt_body`
2025-09-30 20:10:49 -05:00
Aaron Franke 9fbf5808a0 Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Mikael Hermansson a285ab6bcf Fix crash when calling move_and_collide with a null jolt_body 2025-09-27 13:30:04 +02:00
Mikael Hermansson 0590c974c1 Fix CCD bodies adding multiple contact manifolds when using Jolt 2025-09-26 01:17:11 +02:00
Yufeng Ying 05dae23f18 Remove dependency of variant.h in print_string.h
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-09-19 14:57:36 +08:00
Luo Zhihao 793228f171 JoltPhysics: Fix orphan StringName 2025-09-08 22:18:46 +08:00
Jorrit Rouwe 09fcaa7db4 Fixed crash when rendering a soft body 3d
When a mesh is provided that has vertices that are not referenced by any face, these vertices will be discarded. In the internal 'mesh_to_physics' map, this led to uninitialized data which could result in a crash. Now we initialize the map with -1 and report an error when users try to manipulate these vertices.

Fixes #109883
2025-08-24 15:38:11 +02:00
Mikael Hermansson 6c907c2d37 Fix move_and_slide forcing synchronization with physics thread
Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
2025-08-14 18:58:36 +02:00
Thaddeus Crews 8c0900450c Merge pull request #108495 from simpkins/deadlock_comments
Document some deadlocks in the physics server code
2025-07-18 11:05:12 -05:00
Adam Simpkins cb25b933e7 Document some deadlocks in the physics server code
Add some comments documenting locations where
PhysicsServer3D::soft_body_set_mesh() can deadlock.

godotengine/godot-proposals#12670 has a proposal for some alternate
thread-safe soft body APIs.  In the meantime it seems worth at least
documenting some of the current pitfalls in the code.
2025-07-13 13:44:48 -07:00