Commit Graph

306 Commits

Author SHA1 Message Date
Ricardo Buring
bec1182093 Revert attempted fix of trimesh CCD 2023-03-13 13:54:10 +01:00
Rémi Verschelde
02e5da2cc5
Merge pull request #72917 from rburing/fix_trimesh_ccd
Fix CCD in case of multiple supports in motion direction
2023-02-20 15:40:56 +01:00
Rémi Verschelde
4a1913fc17
Merge pull request #68181 from MarianoGnu/fix-convex-hull-crash
Avoid memory corruption when GodotConvexPolygonShape3D is setup more than once
2023-02-17 00:33:47 +01:00
myaaaaaaaaa
6f88392d02 Move some worker_thread_pool.h includes out of header files 2023-02-13 14:02:01 -05:00
Ricardo Buring
2290f3b6a4 Fix CCD in case of multiple supports in motion direction
For example, an axis-aligned box under the influence of gravity landing
on a horizontal triangle could previously tunnel, because only one of
the supports of the box was considered to be the candidate point that
would collide first. Now all supports are considered as candidates.

Also fix CCD always pushing the fast body into the other body, which
works well for convex shapes but not for trimesh/concave shapes.
2023-02-10 09:55:16 +01:00
smix8
026549db2e Create default World physics spaces on demand only
Changes that the default physics spaces of World resources are only created on first use.
2023-01-31 18:26:52 +01:00
Rémi Verschelde
dfb824c1d1
Merge pull request #72107 from rburing/separation_ray_normal
Fix separation ray normal direction
2023-01-31 10:54:34 +01:00
Aaron Franke
79215131b5
Replace Area gravity point distance scale with unit distance 2023-01-29 22:12:00 -06:00
Aaron Franke
866e2b95dc
Remove deprecated AREA_PARAM_GRAVITY_POINT_ATTENUATION 2023-01-29 22:12:00 -06:00
Ricardo Buring
ed54f4dce8 Fix separation ray normal direction 2023-01-26 12:09:35 +01:00
kobewi
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
Peter Eastman
cd46fceb8b Collision detection supports uniform scaling 2023-01-19 22:16:31 -08:00
Peter Eastman
31c2a24893 Analytic collision normals 2023-01-18 18:24:57 -08:00
Rémi Verschelde
800216924c
Merge pull request #70787 from peastman/cylinder
Analytic sphere-box, sphere-cylinder, and capsule-cylinder collisions
2023-01-12 20:08:03 +01:00
Rémi Verschelde
f82352be87
Merge pull request #70660 from Malcolmnixon/collision_sphere_capsule
Fix sphere-capsule collision logic
2023-01-12 20:07:02 +01:00
Rémi Verschelde
1e32a286f3
Merge pull request #70281 from CherrySodaPop/get-impulse-3d
Implement collision impulse in Godot Physics 3D
2023-01-08 22:40:06 +01:00
Lily Garcia
8ee6264cc9 Implement collision impulse in Godot Physics 3D 2023-01-07 22:34:28 -05:00
Rémi Verschelde
57540ae00d
Merge pull request #70858 from Malcolmnixon/fast-concave-support
Optimize GodotConvexPolygonShape3D::get_support
2023-01-07 13:17:39 +01:00
Rémi Verschelde
163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
151e1355e8
Merge pull request #63650 from fabriceci/apply-moving-platform-angular-velocity
Allow to apply the angular velocity of a moving platform
2023-01-03 12:39:35 +01:00
Malcolm Nixon
37e4f8befa Micro-optimizations of the GodotConvexPolygonShape3D::get_support function. Specifically this uses pointer-array-dereference rather than LocalVector<T> dereference as this performs range-checking on known-good indexes.
Added more comments. Changed loops back to classic for-iteration style.
2023-01-02 21:15:46 -05:00
Peter Eastman
d1f95c75cc Analytic sphere-box, sphere-cylinder, and capsule-cylinder collisions 2023-01-02 12:30:16 -08:00
Malcolm Nixon
220e8a0390 Modified the collision_sphere_capsule function to only test the one "correct" axis which corresponds to the correct collision normal.
Added logically identical fix to the capsule/capsule collision, and verified it now produces correct collision points and normals.

Added analytic_sphere_collision helper function which reports the A and B points directly without using SAT.

Modified _collision_sphere_sphere, _collision_sphere_capsule, and _collision_capsule_capsule to use the new analytic_sphere_collision.

Fix white-space issue

Additional code formatting fixes.

Updated new analytic_sphere_collision to correctly handle null collector callback.
2023-01-02 14:52:19 -05:00
Malcolm Nixon
dfa2a0c9ae Remove unnecessary bail-out if shape A is concave. The test for A being concave is already performed later. 2022-12-27 20:45:43 -05:00
Geekotron
ae55229618 Fix regression 70154 caused by my prior CCD fix.
At high velocities `from - motion *.1` is *behind the RB* - not within its collider as the comment suggested - so it could not be used for determining movement length
2022-12-16 11:39:19 -07:00
Geekotron
57710897d6 Fix Physics3D and Physics2D CCD sometimes adjusting velocity too much (preventing collision) or not enough (allowing tunneling) 2022-12-13 18:01:21 -07:00
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Rémi Verschelde
60a376ae52
Merge pull request #69852 from rburing/heightmap_shape_typo_bugfix
Fix typo bug in heightmap shape
2022-12-11 11:51:46 +01:00
Ricardo Buring
55eceb5150 Fix typo bug in heightmap shape 2022-12-10 12:57:43 +01:00
Rémi Verschelde
de6994aa95
Merge pull request #69674 from rburing/conStraint
Fix typo in physics step: contraint -> constraint
2022-12-07 13:25:28 +01:00
Rémi Verschelde
c241f1c523
Merge pull request #69671 from rburing/cylinder-cylinder_sat_typo
Fix typo in cylinder-cylinder SAT collision solver
2022-12-06 17:44:10 +01:00
Ricardo Buring
53e90bd6ca Fix typo in physics step: contraint -> constraint 2022-12-06 17:32:45 +01:00
Ricardo Buring
e2b013380d Fix typo in cylinder-cylinder SAT collision solver 2022-12-06 16:43:45 +01:00
Ricardo Buring
29ab86aa7d Fix collision detection for degenerate capsules
In GodotCapsuleShape3D::get_supports and
GodotCapsuleShape2D::get_supports, return a point instead of an edge of
length zero in case the capsule degenerates to a sphere or circle.
2022-12-06 14:17:24 +01:00
Markus Sauermann
28af870750 Code simplifications found by cppcheck
They are based on:
- Boolean arithmetic simplifications
- setting variables that are not accessed
- constant variables
2022-11-21 08:43:36 +01:00
kobewi
d9f066d5fa Remove duplicate project settings definitions 2022-11-08 01:29:39 +01:00
Mariano Javier Suligoy
a39ac1383b Avoid memory corruption when GodotConvexPolygonShape3D is setup more than once 2022-11-02 16:16:18 -03:00
Aaron Franke
8556fdd4bc
Move EulerOrder enum to math_defs.h and global scope 2022-11-02 13:44:13 -05:00
Mark Riedesel
7d1a159ba1 Add safety check for at least 2 nodes and 1 link to GodotSoftBody3D.reoptimize_link_order() before proceeding. Fixes #61474 2022-10-31 10:14:02 -05:00
Clay John
aa989cb26f
Merge pull request #64382 from peastman/support
Optimized support function for large meshes
2022-10-27 12:40:39 -07:00
Cykyrios
44b93006c4 Fix RigidBody3D inertia calculation 2022-10-19 23:26:20 +02:00
Peter Eastman
562aa1bf76 Optimized support function for large meshes 2022-10-18 19:54:29 -07:00
Juan Linietsky
71d2e38cb5 Optimize Convex Collision
Implements the Gauss Mapping optimization to SAT convex collision test.

* Described [here](https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2013/slides/822403Gregorius_Dirk_TheSeparatingAxisTest.pdf) by Dirk Gregorius.
* Requires adding of face information to edges in MeshData
* Took the chance to convert MeshData to LocalVector for performance.
2022-10-13 19:07:53 +02:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde
5b6ccf2fd2 Merge pull request #66720 from qarmin/unintialized_memory
Remove usage of unitialized variables
2022-10-05 11:42:47 +02:00
Rafał Mikrut
2233624152 Remove usage of unitialized variables 2022-10-01 21:09:22 +02:00
Haoyu Qiu
8320e12ac1 Fix crash when executing PhysicsServer2D.joint_clear 2022-09-30 10:36:05 +08:00
Rémi Verschelde
6b5880b765 Merge pull request #66568 from rburing/cylinder_support_is_dead
`GodotCylinderShape3D::get_supports`: delete dead code
2022-09-28 23:52:28 +02:00
Ricardo Buring
215c5458f5 GodotCylinderShape3D::get_supports: delete dead code 2022-09-28 21:37:37 +02:00