Commit graph

332 commits

Author SHA1 Message Date
rafallus
cfa06f0f76 Unexpose _direct_state_changed in PhysicsBody
Removed _direct_state_changed bindings
Affects 2D and 3D nodes
Callbacks now use Callable
Tests were changed accordingly
2021-04-22 23:20:58 -05:00
Rémi Verschelde
fdf041a466
Merge pull request #47347 from nekomatata/heightmap-support
Heightmap collision shape support in Godot Physics
2021-04-20 17:40:28 +02:00
Marcel Admiraal
ff9a6c4e39 Check for the use of an empty shape in Bullet Kinematic collisions 2021-04-06 18:40:13 +01:00
PouleyKetchoupp
c8dd3c7d80 Heightmap collision shape support in Godot Physics 2021-03-25 16:52:41 -07:00
Rémi Verschelde
fa681d04b7
Merge pull request #46937 from nekomatata/soft-body-support
SoftBody support in GodotPhysics 3D
2021-03-20 21:45:20 +01:00
PouleyKetchoupp
7bbd545432 Disable backface collision with ConcavePolygonShape by default
Helps a lot with soft bodies and generally useful to avoid shapes to go
through the ground in certain cases.

Added an option in ConcavePolygonShape to re-enable backface collision
on specific bodies if needed.
2021-03-18 11:30:22 -07:00
PouleyKetchoupp
d5ea4acd2d SoftBody support in GodotPhysics 3D
- Fixed SoftBody surface update with new rendering system
- Added GodotPhysics implementation for SoftBody
- Added support to get SoftBody rid to interact with the physics server
- Added support to get SoftBody bounds from the physics server
- Removed support for unused get_vertex_position and get_point_offset
from the physics server
- Removed SoftBody properties that are unused in both Bullet and
GodotPhysics (angular and volume stiffness, pose matching)
- Added RenderingServerHandler interface to PhysicsServer3D so the physics servers don't need to reference the class from SoftBody node directly
2021-03-18 09:04:17 -07:00
Anshul7sp1
91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Duddino
c47070e165 Added some checks to prevent accessing a null collider
Previously godot would try to access
`CollisionObjectBullet::bt_collision_object` even if it was null.
Fixes #46651
2021-03-06 12:07:27 +01:00
reduz
8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
Rafał Mikrut
f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Aaron Franke
cb9fc117d1
Use real_t in physics code 2021-01-28 18:15:42 -05:00
Rémi Verschelde
011d201046
Merge pull request #43923 from madmiraal/fix-43588
Fix cast_motion sometimes failing
2021-01-14 20:44:19 +01:00
Marcel Admiraal
797a7fc6cc Only remove Bullet's body constraints when removing body from space 2021-01-13 13:32:46 +00:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal
026aa4381d Add signal to inform joint that body has exited tree 2020-12-31 16:19:57 +00:00
Rémi Verschelde
a04b9669e8
Merge pull request #42881 from madmiraal/fix-39767
Set Bullet collision shape index to zero when using a single shape or ConcavePolygonShape
2020-12-28 16:16:33 +01:00
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Rémi Verschelde
33ad8c5048
Merge pull request #43898 from madmiraal/fix-43852
Remove any constraints connected to a Bullet body when removing it
2020-12-19 09:29:45 +01:00
Rémi Verschelde
c7b53c03ae
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.
2020-12-18 10:29:34 +01:00
Marcel Admiraal
9bc62bf449 Remove Generic6DOFJoint precision property 2020-12-15 10:14:48 +00:00
Marcel Admiraal
356a2b7235 Fix cast_motion sometimes failing
- Fixes Godot physics failing when the cast Shape is inside of, or
already colliding with another Shape.
- Fixes Bullet physics failing when there is no motion.
- Ensures Godot and Bullet physics behave the same.
- Updates the documentation to exclude the caveats for the failures and
differences.
2020-11-27 15:33:00 +00:00
Marcel Admiraal
6fe2206ec6 Remove any constraints connected to a Bullet body when removing it 2020-11-26 18:18:41 +00:00
PouleyKetchoupp
faca8b77aa Fixed ccd enabled by default on Bullet bodies
It was due to main_shape_changed being called two times for each
added body. The first time it disables ccd, which sets the internal ccd
threshold to be 10000. The second time, it enables ccd again because
the internal threshold is > 0.

Bodies are now consistently set with a ccd threshold of 0 when ccd is
disabled.

This was causing crashing asserts in Bullet when adding bodies in some
scenarios, in btVector3::normalize():
btAssert(!fuzzyZero());

These crashes will still happen with ccd enabled.
2020-11-25 15:02:33 -07:00
Rémi Verschelde
d7176e9040
Merge pull request #42167 from madmiraal/fix-42108
Remove the unnecessary sync() and the restrictions it imposes on 3D Physics.
2020-11-16 09:32:48 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Marcel Admiraal
7f26ce4486 Set Bullet collision shape index to zero when using a single shape
or ConcavePolygonShape3D.
2020-10-19 11:51:11 +01:00
reduz
ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Rémi Verschelde
5971a97a0c
Merge pull request #42649 from madmiraal/reapply-41806
Reapply -Avoid adding margin twice along capsule Y axis
2020-10-15 17:20:22 +02:00
Rémi Verschelde
4efcb4c442
Merge pull request #42592 from madmiraal/fix-42567
Initialise Bullet RigidBody friction to the expected value of 1.0
2020-10-13 09:51:53 +02:00
Marcel Admiraal
0e12a0c66a Reapply -Avoid adding margin twice along capsule Y axis
Co-authored-by: Andrea Catania <info@andreacatania.com>
2020-10-08 16:22:38 +01:00
Andrea Catania
2e8cb8a9e2 Fixed #41040 in an alternative way now that #39726 is reverted 2020-10-08 13:10:48 +02:00
Andrea Catania
1829c67762 Revert "Optimized physics object spawn time and optimized shape usage when the shape is not scaled"
This reverts commit 7709a83493.
2020-10-08 12:22:59 +02:00
Andrea Catania
8827e315d4 Revert "- Enhanced the flush mechanism by flushing only needed thing."
This reverts commit 8d0d6d6921.
2020-10-08 12:16:12 +02:00
Marcel Admiraal
47431dbb8e Initialise Bullet RigidBody friction to the expected value of 1.0 2020-10-06 09:10:05 +01:00
Duroxxigar
4834e14493 Updated getters and setters names for toplevel 2020-10-02 19:09:01 -04:00
Marcel Admiraal
5278e07095 Check entire basis column for zero size when unscaling Bullet basis. 2020-10-02 10:30:08 +01:00
Rémi Verschelde
0923a1f700
Merge pull request #41426 from madmiraal/fix-bullet-zero-scale
Check and correct for zero scaling when unscaling Bullet basis.
2020-09-20 09:24:50 +02:00
Marcel Admiraal
41209efa7f Remove the unnecessary sync() and the restrictions it imposes on 3D Physics. 2020-09-18 10:43:31 +01:00
Marcel Admiraal
7e73dd0b2e Fix RigidBodyBullet areasWhereIam element shift. 2020-09-14 18:43:21 +01:00
Andrea Catania
53e42930d9
Avoid adding margin twice along capsule Y axis 2020-09-06 11:33:27 +02:00
Marcel Admiraal
4b14916288 Check and correct for zero scaling when unscaling Bullet basis. 2020-08-22 08:16:13 +01:00
Andrea Catania
6831da630f
Merge pull request #40989 from madmiraal/fix-40739
Reload Bullet space override modifier even when RigidBody is inactive.
2020-08-05 13:54:25 +02:00
Rafał Mikrut
ac1b2da96e Fixes leak when creating bullet shape 2020-08-05 10:04:04 +02:00
Marcel Admiraal
3a05ca9c2b Reload Bullet space override modifier even when RigidBody is inactive. 2020-08-03 11:39:16 +01:00
Rémi Verschelde
c845e20add Revert "Allow Area2D and 3D mouse events without a collision layer"
This reverts commit 7eebb06b55.
2020-07-27 22:45:01 +02:00
Rémi Verschelde
3e87022ecc
Merge pull request #40252 from AndreaCatania/flush
Improved Bullet Physics flush algorithm, Lazy collision filter reload, Shape reload regression fix.
2020-07-27 13:57:47 +02:00
Andrea Catania
8d0d6d6921 - Enhanced the flush mechanism by flushing only needed thing.
- Flushing Areas before anything else.
- Make sure to correctly fetch gravity when the integrate_forces function is used
- Lazy reload body when layer and mask changes
- Shapes are reloaded just before the physics step starts.
- Improved some other parts of the code.
- Added override keyword
- Using LocalVector
2020-07-27 08:25:47 +02:00
Marcel Admiraal
236857c92a Ensure Bullet HeightMapShape3D data width and depth are at least 2. 2020-07-24 13:40:26 +01:00
Marcel Admiraal
ec92a26d08 Use difference in position to check whether motion in Bullet is too close
to zero.
2020-07-18 13:15:10 +01:00