Commit Graph

296 Commits

Author SHA1 Message Date
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
Rémi Verschelde 3be409aa5e
Merge pull request #54039 from nekomatata/fix-soft-body-memory-corruption-bullet-3.x 2021-11-08 23:59:05 +01:00
Rémi Verschelde 14c366ddd7
Bump version to 3.5-beta 2021-11-05 16:10:17 +01:00
PouleyKetchoupp 63f6d91a1a Fix SoftBody memory corruption when using invalid mesh
In case of failure the new soft body wasn't created but the previous one
wasn't destroyed, causing discrepancies with visual server updates.
2021-10-20 10:39:16 -07:00
Haoyu Qiu ed5a98c3c6 Fix crash when pinned SoftBody point is out of range 2021-10-04 15:47:12 +08:00
Rémi Verschelde 06e0260699
Merge pull request #53349 from LATRio/53331_1 2021-10-03 12:16:45 +02:00
LATRio 56aa9f71b6 Prevent out of bound access through 'm_nodes' in SoftBodyBullet 2021-10-03 16:36:01 +09:00
LATRio be69d26403 Fix crash at SoftBodyBullet::reset_all_node_positions when bt_soft_body isn't initialized
Update soft_body_bullet.cpp
2021-10-02 22:03:54 +09:00
Rémi Verschelde fba9fb2439
Merge pull request #53183 from m4nu3lf/threadsafe_bullet_3.x 2021-09-29 21:34:56 +02:00
Rémi Verschelde b7901c773c
bullet: Sync with upstream 3.17
Stop include Bullet headers using `-isystem` for GCC/Clang as it misleads
SCons into not properly rebuilding all files when headers change.

This means we also need to make sure Bullet builds without warning, and
current version fares fairly well, there were just a couple to fix (patch
included).

Increase minimum version for distro packages to 2.90 (this was never released
as the "next" version after 2.89 was 3.05... but that covers it too).
2021-09-29 16:30:34 +02:00
Manuele Finocchiaro 6f81c213a6 Compile bullet with threasafe switch on 2021-09-28 17:21:26 +01:00
BimDav 9de9994444
Reload kinematic shapes when changing PhysicsBody mode to Kinematic
Prevents a crash when calling test_body_motion. Call reload_kinematic_shapes
from init_kinematic_utilities as they are always called together.

(cherry picked from commits 112985c5bc
and 3540e716f9)
2021-09-27 18:10:30 +02:00
Haoyu Qiu 70853fd669 Remove do{ } while(0) wrapper around error macros 2021-09-12 15:04:53 +08:00
Rémi Verschelde 85e13a4e02
Merge pull request #51858 from nekomatata/bullet-test-body-motion-depth-3.x
[3.x] Add collision depth and safe/unsafe fraction to Bullet body_test_motion
2021-08-18 22:45:54 +02:00
PouleyKetchoupp 02adb0e361 Add collision depth and safe/unsafe fraction to Bullet body_test_motion
It was only implemented for godot physics before.
2021-08-18 13:09:27 -07:00
PouleyKetchoupp db47b670f6 Fix crash in body_test_motion when used with RigidBody3D in Bullet
Kinematic utilities are now initialized for a rigid body if needed for a
call to body_test_motion.
2021-08-18 13:07:21 -07: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
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
Rémi Verschelde b0b2b7df31
Merge pull request #50257 from Calinou/physicsserver3d-add-set-iterations-3.x
Add a method to set the number of physics solver iterations in 3D (3.x)
2021-07-14 07:56:57 +02:00
Hugo Locurcio 9259b4adc4
Add a method to set the number of physics solver iterations in 3D
This is only for GodotPhysics, and adds a 3D counterpart to the 2D
method that was recently added.
2021-07-10 16:29:41 +02:00
Hugo Locurcio 4a140294fe
Fix typo in Bullet method name: "collisin" -> "collision"
This method is not exposed to scripting, so compatibility with
existing projects should be preserved.
2021-07-07 22:07:32 +02:00
Marcel Admiraal 7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Marcel Admiraal 5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Rémi Verschelde 80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02: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 e94161dada
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.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Marcel Admiraal 1e28e234c5
Check for the use of an empty shape in Bullet Kinematic collisions
(cherry picked from commit ff9a6c4e39)
2021-04-06 22:37:35 +02:00
Duddino aabb8d78ef 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

(cherry picked from commit c47070e165)
2021-03-07 22:51:06 +01:00
Rémi Verschelde d298949513
Merge pull request #42882 from madmiraal/fix-39767-3.2
[3.2] Set Bullet collision shape index to zero when using a single shape or ConcavePolygonShape
2021-01-14 20:46:06 +01:00
Rémi Verschelde 152415a006
Merge pull request #43924 from madmiraal/fix-43588-3.2
[3.2] Fix cast_motion sometimes failing
2021-01-14 20:44:40 +01:00
Rémi Verschelde f93c2ddc92
Merge pull request #45163 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 16th batch
2021-01-13 17:38:05 +01:00
Rémi Verschelde 652105dcdd
Merge pull request #44704 from madmiraal/fix-44510-3.2
[3.2] Add signal to inform joint that body has exited tree
2021-01-13 17:16:19 +01:00
Rémi Verschelde b64fe918aa
Merge pull request #45160 from madmiraal/fix-45145-3.2
[3.2] Only remove Bullet's body constraints when removing body from space
2021-01-13 17:16:01 +01:00
Rémi Verschelde 8a8e0ae2eb
Merge pull request #40990 from madmiraal/fix-40739-3.2
[3.2] Reload Bullet space override modifier even when RigidBody is inactive.
2021-01-13 16:44:04 +01:00
Rémi Verschelde 49646383f1
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Marcel Admiraal 47657cd140 Only remove Bullet's body constraints when removing body from space 2021-01-13 13:45:40 +00:00
Marcel Admiraal 6b3bab6e54 Add signal to inform joint that body has exited tree 2020-12-31 14:51:07 +00:00
Rémi Verschelde 344a02834b
Merge pull request #43899 from madmiraal/fix-43852-3.2
[3.2] Remove any constraints connected to a Bullet body when removing it
2020-12-19 09:31:04 +01:00
Marcel Admiraal 825ad65fc4 Remove Generic6DOFJoint precision property 2020-12-15 10:15:42 +00:00
Marcel Admiraal 2e99b5b137 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:32:25 +00:00
Marcel Admiraal 4bfcaeff5a Remove any constraints connected to a Bullet body when removing it 2020-11-26 18:16:47 +00:00
Rémi Verschelde fc5b106369
Merge pull request #42168 from madmiraal/fix-42108-3.2
[3.2]  Remove the unnecessary sync() and the restrictions it imposes on 3D Physics.
2020-11-16 09:33:17 +01:00
Marcel Admiraal b7d00a364e Set Bullet collision shape index to zero when using a single shape
or ConcavePolygonShape.
2020-10-19 11:50:29 +01:00
Marcel Admiraal d9d9be07c2
Check entire basis column for zero size when unscaling Bullet basis.
(cherry picked from commit 5278e07095)
2020-10-04 20:52:38 +02:00