Commit graph

1981 commits

Author SHA1 Message Date
Josh Jones 9aadd0cde7 [Godot Physics]: Correct typo in moment of inertia calculations.
The moment of inertia calculation for BoxShape is:

```
Vector3(
    (p_mass / 3.0) * (ly * ly + lz * lz), 
    (p_mass / 3.0) * (lx * lx + lz * lz), 
    (p_mass / 3.0) * (lx * lx + ly * ly));
```

where the final line includes both the x and y extents.

However, for CapsuleShape3D, CylinderShape3D, ConvexPolygonShape3D, ConcavePolygonShape3D, and HeightMapShape3D, the final line read `(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y)`.  I believe this is a mistake, considering the comment in each case mentions using an AABB approximation, which should follow the same approach as BoxShape.

This change corrects the final line to include both the x and y components of the shape's extent.
2021-03-22 20:10:11 -07:00
Rémi Verschelde 992de9c053
Merge pull request #46917 from nekomatata/solver-kinematic-bug-fix
Fix GodotPhysics solver with kinematic body set to report contacts
2021-03-20 21:53:01 +01:00
Rémi Verschelde 900b28f6d8
Merge pull request #47130 from e344fde6bf/fix-angular-velocity-calculation
Fix kinematic angular velocity calculations
2021-03-20 21:46:02 +01: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
Rémi Verschelde 793000c6a9
Merge pull request #47139 from nekomatata/concave-backface-collision
Disable backface collision with ConcavePolygonShape by default
2021-03-20 21:43:57 +01:00
e344fde6bf 1c123aaf2b Fix some angular velocity calculations
The angular velocity estimate for kinematic bodies was calculated
incorrectly.  Also, fixes its use in some kinematic/rigid collision
calculations.

This fixes #47029.
2021-03-20 07:21:37 +10: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
Rémi Verschelde 2fd445cc18
Merge pull request #47133 from groud/navigation_2d_bugfix
Make 2D navigation consider scale
2021-03-18 15:42:46 +01:00
Gilles Roudière 6249ebb9c8 Make 2D navigation consider scale 2021-03-18 15:17:23 +01:00
Rémi Verschelde c097ce0c18
Merge pull request #47125 from BastiaanOlij/SCsub_compile_shaders
Changed SCsub for shaders to find shaders automatically
2021-03-18 11:20:57 +01:00
Bastiaan Olij 7f63c9e7c9 Changed SCsub for shaders to find shaders automatically and create dependencies with include files 2021-03-18 12:59:47 +11:00
jmb462 b588232b83 Fix AudioEffectCapture buffer length cannot be changed 2021-03-17 23:07:38 +01:00
Ignacio Abal ccdd7ab890 Added validation when assigning heightfield_resolution (Fix #46281) 2021-03-17 12:03:52 -03:00
Rémi Verschelde af0806722f
Merge pull request #47067 from nekomatata/cylinder-fix-margins
Fix Cylinder shape collision with margins when using GJK-EPA
2021-03-17 11:05:13 +01:00
Rémi Verschelde 3651406258
Merge pull request #47084 from nekomatata/cylinder-capsule-collision-fix
Fix capsule-cylinder collision in godot physics
2021-03-17 11:01:04 +01:00
Rémi Verschelde 08ca4184f4
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
2021-03-17 09:18:54 +01:00
PouleyKetchoupp 380f04fa0d Fix capsule-cylinder collision in godot physics
Test specific axes before falling back to GJK-EPA algorithm to get more
accurate separation axes for common cases, the same way it's done for
cylinder-cylinder collision.
2021-03-16 19:22:59 -07:00
Rémi Verschelde 9ca0d66a3b
Merge pull request #46984 from sboronczyk/fix-shader-issue
Vulkan: Fix crash when opening a ShaderMaterial with code saved as an external .shader file
2021-03-16 23:32:06 +01:00
PouleyKetchoupp 93076ef117 Fix Cylinder shape collision with margins when using GJK-EPA
In the case of falling back to GJK-EPA algorithm to generate cylinder
contact points, margins were never taken into account.

This fixes the depenetration phase for kinematic bodies and allows
consistent floor detection for cylinder shapes.
2021-03-16 10:19:26 -07:00
Gilles Roudière ac7073f586 Allow Navigation to be more flexible 2021-03-15 15:58:59 +01:00
Kongfa Waroros 916e576021 Check if an input image wasn't Image on several functions in CameraFeed 2021-03-14 16:47:21 +07:00
sboronczyk 3e7c5d2ca5 fix issue vulkan crash on open shader materials 2021-03-13 22:54:33 +01:00
PouleyKetchoupp c5d2404a13 Fix GodotPhysics solver with kinematic body set to report contacts
In 3D, collision is disabled between kinematic/static bodies when
contacts are generated only to report them.

In 2D, this case was already fixed but the code is cleaned to make it
easier to follow.
2021-03-11 18:06:00 -07:00
Bastiaan Olij f7cbeb0d1b Removed time duplicate from ForwardClustered. Just use the variable from its superclass 2021-03-11 18:08:10 +11:00
Bastiaan Olij 73b5eb2673 Combine init_gi and init_sdfgi into a single init 2021-03-11 18:07:33 +11:00
Bastiaan Olij 52ab369d5f Renamed one more Forward render struct and fixed typo 2021-03-11 14:18:05 +11:00
Bastiaan Olij dfc41eb6f6 Moving RendererStorageRD *storage to protected, no sense duplicating it in forward_clustered 2021-03-11 13:24:23 +11:00
Bastiaan Olij 01851defb5
Merge pull request #46811 from BastiaanOlij/rename_forward_renderer
Renaming RendererSceneRenderForward to ...ForwardClustered
2021-03-10 23:36:08 +11:00
Bastiaan Olij a895844c82 Renaming RendererSceneRenderForward to RendererSceneRenderForwardClustered so we can introduce RendererSceneRenderForwardMobile 2021-03-10 22:34:50 +11:00
Gilles Roudière ba1344408f Implement Navigation layers 2021-03-10 11:23:06 +01:00
Kyle 554990992a Fixes division by zero when 3d body does not have valid shape
Fixes #46738 by setting the default inertia to a valid value when there are no valid shapes for a 3d body.
Changed the comment style for the update_inertias method as well.
2021-03-08 19:25:26 -05:00
Rémi Verschelde 3856bc5afe
Merge pull request #46642 from BastiaanOlij/sdfgi_rename_and_cleanup
Renamed SDGIShader to SDFGIShader and moved a bunch of things to private
2021-03-08 08:22:48 +01:00
Ev1lbl0w 1f0b60c47d
Fix negative VRAM values 2021-03-05 21:48:20 +00:00
Alex Hirsch 426ef4b1ee Fix canvas renderer line width
fix #46644
2021-03-04 21:37:06 +01:00
Bastiaan Olij 760be46a81 Renamed SDGIShader to SDFGIShader and moved a bunch of things to private 2021-03-04 11:53:09 +11:00
Rémi Verschelde 8c45b1d61c
Merge pull request #46594 from asheraryam/fix-clip-content-master
Fix rounding error in Clip Content [4.0]
2021-03-02 17:07:00 +01:00
Rémi Verschelde 5885381373
Merge pull request #46581 from Riteo/fix-capsule-shape
Change CapsuleShape3D's collision detection axis to vertical
2021-03-02 16:46:48 +01:00
asheraryam c3d8538bb4 Fix rounding error in Clip Content
Rounds the position and size of the final clip rect to avoid flickering issues.

Fixes https://github.com/godotengine/godot/issues/46493
2021-03-02 18:36:28 +03:00
Riteo Siuga b24bba95d0 Change CapsuleShape3D's collision detection axis to vertical
This fixes an issue where its collision detection would actually work as if it had the old default orientation.
2021-03-02 08:33:44 +01:00
Rémi Verschelde da8eef486b
Merge pull request #46046 from BastiaanOlij/cleanup_gi
Moving GI and Sky code from RendererSceneRenderRD into separate classes
2021-03-01 19:34:53 +01:00
Rémi Verschelde e9cb64a8b5
Merge pull request #46522 from Ev1lbl0w/bugfix-shader_noret
Added missing returns on error scenarios
2021-03-01 09:36:15 +01:00
Yuri Roubinsky 19e0a1ec9d Fix parsing hexadecimal (lowercase e,f) in shaders 2021-03-01 09:08:44 +03:00
Ev1lbl0w 3d9ef1e4de
Added missing returns on error scenarios 2021-02-28 19:48:35 +00:00
Eryk Dwornicki fb9d6fcc6d Refactor removal of constraints from bodies in 2D joints 2021-02-27 20:52:01 +01:00
Eryk Dwornicki aa42e8920b Move removal of the constraints from bodies to Joint3DSW destructor
Joint3DSW instances are also destroyed without explicitly calling free()
for example when changing constrainted bodies at runtime using
set_node method.
2021-02-27 20:52:01 +01:00
booer 65975b9a08 Update Inspector when changing AudioEffectChorus voice_count
Fixes #31627.
2021-02-25 17:32:50 +01:00
Bastiaan Olij 1f96ba5141 Moving GI code into RendererServerGIRD
Moving Skyshader code into RendererServerSkyRD
2021-02-25 15:15:48 +11:00
Rémi Verschelde a930472319
Merge pull request #45863 from nekomatata/physics-queries-disabled-shapes
Fix physics queries not filtering out disabled collision shapes
2021-02-24 13:05:28 +01:00
Rémi Verschelde a527c6856b
Merge pull request #46045 from bruvzg/text_server_bmp_create
[TextServer] Restores bitmap font dynamic construction functions.
2021-02-24 12:55:36 +01:00