Commit graph

126 commits

Author SHA1 Message Date
Hugo Locurcio ba65730cbf
Rename RID's getornull() to get_or_null() 2021-09-29 23:58:02 +02:00
BimDav 112985c5bc Reload kinematic shapes when changing PhysicsBody mode to Kinematic to prevent a crash when calling test_body_motion. Call reload_kinematic_shapes from init_kinematic_utilities as they are always called together. 2021-09-27 09:44:09 +02:00
PouleyKetchoupp 45bc97b8b8 Fixes in Bullet body_test_motion
Synchronize fixes from the 3.x branch to keep Bullet code in sync for
later, even if it's disabled for now.
2021-08-18 13:18:19 -07:00
PouleyKetchoupp ec9fed69f4 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 20:21:04 -07:00
PouleyKetchoupp 940838c174 One-directional collision layer check for rigid bodies and soft bodies
Check for each body individually if it collides with the other one or
ignores it.

When a body is being ignored, the other body's mass is considered
infinite when applying impulses to avoid extra overlapping.
2021-07-19 17:24:04 -07:00
Marcel Admiraal b8fe576355 Ensure KinematicBodies only interact with other Bodies with matching mask. 2021-07-19 17:03:43 +01:00
Rémi Verschelde c1c76850cb
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.
2021-06-07 11:03:08 +02:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Marcel Admiraal ff9a6c4e39 Check for the use of an empty shape in Bullet Kinematic collisions 2021-04-06 18:40:13 +01:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
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 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
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
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
Duroxxigar 4834e14493 Updated getters and setters names for toplevel 2020-10-02 19:09:01 -04:00
Rafał Mikrut ac1b2da96e Fixes leak when creating bullet shape 2020-08-05 10:04:04 +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 ec92a26d08 Use difference in position to check whether motion in Bullet is too close
to zero.
2020-07-18 13:15:10 +01:00
Marcel Admiraal f31b2a1bba Move Bullet physics query flush from Bullet space pre-tick callback to
Bullet physics flush_queries() as is done in Godot physics, and remove
the pre-tick callback.
2020-07-08 11:39:41 +01:00
Rémi Verschelde bd3a468fc2
Merge pull request #39726 from AndreaCatania/add_body_impr_physics
Optimized physics object spawn time
2020-07-07 12:15:09 +02:00
Rémi Verschelde 480cb25961
Merge pull request #39735 from AndreaCatania/bullet_phy_add_api
Added BulletPhysics APIs to return internal objects.
2020-07-07 12:13:51 +02:00
Andrea Catania a2b5e7971a Added BulletPhysics APIs to return internal objects and fixed a typo. 2020-06-24 09:09:50 +02:00
Andrea Catania 7709a83493 Optimized physics object spawn time and optimized shape usage when the shape is not scaled 2020-06-24 08:54:11 +02:00
Rémi Verschelde 10d2fa4210
Merge pull request #39747 from nekomatata/fix-crash-space-query
Fix crashes with invalid shapes in BulletPhysicsDirectSpaceState queries
2020-06-22 10:46:39 +02:00
PouleyKetchoupp 8b0232bf29 Fix crashes with invalid shapes in BulletPhysicsDirectSpaceState queries 2020-06-22 10:22:11 +02:00
Marcel Admiraal 8ffe905c45 Check for motion in cast_motion() before doing Bullet convexSweepTest().
Also ensure that default closest_safe and closest_unsafe values are
defined in cast_motion() and before cast_motion() is called.
2020-06-21 16:20:26 +01:00
Rémi Verschelde 0ee0fa42e6 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
2020-05-14 21:57:34 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde dcd1151d77 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
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
PouleyKetchoupp 9353a2bbd1 Better damping implementation for Bullet rigid bodies
Apply old method for linear & angular damping in Bullet, in order to
make it easier to tweak and consistent with Godot Physics.
2020-04-27 18:24:33 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde eaaee63b62 doc: Update classref with node renames
A few extra renames for classes which were missed in last week's PRs.
2020-03-30 18:23:02 +02:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Rémi Verschelde fde1211771
Merge pull request #33690 from Phischermen/area-enhancement
Bullet: Fix detection of concave shape in Area
2020-02-26 21:51:37 +01:00
Phischermen 2c01cf54f8 Enabled concave collision detection with Areas in Bullet. 2020-02-24 07:37:15 -08:00
Juan Linietsky cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03:00
Juan Linietsky dd3682e5fe Modernized default 3D material, fixes material bugs. 2020-02-11 12:01:24 +01:00
Juan Linietsky 4f163972bb Refactored RID/RID_Owner to always use O(1) allocation.
* Implements a growing chunked allocator
* Removed redudant methods get and getptr, only getornull is supported now.
2020-02-11 11:53:26 +01:00