Commit Graph

191 Commits

Author SHA1 Message Date
Rémi Verschelde 262924296b
Merge pull request #27415 from aqnuep/kinematicbody_fixes
KinematicBody performance and quality improvements
2019-05-02 18:03:58 +02:00
Rémi Verschelde d52b70fb5e SCons: Always use env.Prepend for CPPPATH
Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
2019-04-30 13:12:06 +02:00
Rémi Verschelde f40c62fa29
Merge pull request #27371 from ShyRed/fixdisabled2dcollisions
Allow adding disabled shapes
2019-04-30 11:43:11 +02:00
Rémi Verschelde c2a669a9f0 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
ShyRed a9d4cde0f5 Allow adding disabled shapes
Adds the ability to directly add disabled shapes to a collision object. Before this commit a shape has always been assumed to be enabled and had to be disabled in an extra step.
2019-04-23 18:06:48 +02:00
Rémi Verschelde 458827efc2
Revert "Implemented terrain raycast acceleration" 2019-04-23 13:56:23 +02:00
Hein-Pieter van Braam 4575769115
Merge pull request #25543 from Zylann/optimize_bullet_heightfield_raycast2
Implemented terrain raycast acceleration
2019-04-23 06:25:15 +03:00
Hein-Pieter van Braam 7ba772d4ba
Merge pull request #27730 from ShyRed/fix3dphyscansleep
Fix missing re-activation of bullet physics sleep feature
2019-04-23 06:03:27 +03:00
Rémi Verschelde 6af69f851a doc: Drop unused <demos> tag 2019-04-19 11:03:46 +02:00
ShyRed 0877cf6419 Fix missing re-activation of bullet physics sleep feature
Adds the missing option of re-enabling the sleep feature in bullet physics once a body had the sleep feature disabled.
2019-04-06 17:11:36 +02:00
Marc Gilleron cdcdba704b Fix wrong heights data used to compute min and max heights 2019-04-04 21:22:18 +01:00
Rémi Verschelde 39c868171e doc: Bump version to 3.2 2019-04-01 12:33:56 +02:00
Daniel Rakos 6dd65c0d67 KinematicBody performance and quality improvements
With this change finally one can use compound collisions (like those created
by Gridmaps) without serious performance issues. The previous KinematicBody
code for Bullet was practically doing a whole bunch of unnecessary
calculations. Gridmaps with fairly large octant sizes (in my case 32) can get
up to 10000x speedup with this change (literally!). I expect the FPS demo to
get a fair speedup as well.

List of fixes and improvements:

- Fixed a general bug in move_and_slide that affects both GodotPhysics and
  Bullet, where ray shapes would be ignored unless the stop_on_slope parameter
  is disabled. Not sure where that came from, but looking at the 2D physics
  code it was obvious there's a difference.
- Enabled the dynamic AABB tree that Bullet uses to allow broadphase collision
  tests against individual shapes of compound shapes. This is crucial to get
  good performance with Gridmaps and in general improves the performance
  whenever a KinematicBody collides with compound collision shapes.
- Added code to the broadphase collision detection code used by the Bullet
  module for KinematicBodies to also do broadphase on the sub-shapes of
  compound collision shapes. This is possible thanks to the dynamic AABB
  tree that was previously disabled and it's the change that provides the
  biggest performance boost.
- Now broadphase test is only done once per KinematicBody in Bullet instead of
  once per each of its shapes which was completely unnecessary.
- Fixed the way how the ray separation results are populated in Bullet which
  was completely broken previously, overwriting previous results and similar
  non-sense.
- Fixed ray shapes for good now. Previously the margin set in the editor was
  not respected at all, and the KinematicBody code for ray separation was
  complete bogus, thus all previous attempts to fix it were mislead.
- Fixed an obvious bug also in GodotPhysics where an out-of-bounds index was
  used in the ray result array.

There are a whole set of other problems with the KinematicBody code of Bullet
which cost performance and may cause unexpected behavior, but those are not
addressed in this change (need to keep it "simple").

Not sure whether this fixes any outstanding Github issues but I wouldn't be
surprised.
2019-03-27 00:39:47 +01:00
Rémi Verschelde e22f6e9ace
Revert "Optimized area check" 2019-02-22 12:46:54 +01:00
marxin c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
Rémi Verschelde ced77db950
Merge pull request #26111 from AndreaCatania/areaopti
Optimized area check
2019-02-21 13:58:38 +01:00
Andrea Catania b1934cfd0d Optimized area check 2019-02-21 08:41:31 +01:00
Daniel Rakos 6587024207 Fix RayShape collision jitter when used with a RigidBody
Scaling the depth was the wrong solution for the KinematicBody jitter
because it causes jitter with RigidBody. Instead scale the margin that
is ignored to allow KinematicBody to still pick up the ray shape in the
kinematic test when the shape is just at margin distance from another
one. This solution does not cause jitter with either KinematicBody or
RigidBody.
2019-02-20 15:06:08 +01:00
Rémi Verschelde 2f9b7e6b63
Merge pull request #25788 from aqnuep/rayshape_fix
Fix RayShape collision when used with a KinematicBody (Bullet Physics)
2019-02-19 14:42:04 +01:00
Daniel Rakos f7511511b1 Fix RayShape collision when used with a KinematicBody (Bullet Physics)
- Added code handling non-compound collision to recover_from_penetration_ray()
  which is now needed due to the optimization avoiding the use of compound
  collisions when only a single collision shape is used.
- Removed arbitrary margin applied in the collision algorithm of RayShapes
  which causes jittered movement. For lack of a better replacement and for
  lack of any explanation on why it has been introduced, it's now using the
  shape's margin property instead which is small enough to not show visible
  jitter.
- Tried to get rid of inconsistent uses of the collision margin.
- Removed hack from GodotDeepPenetrationContactResultCallback::addContactPoint
  for RayShape collision as it's no longer needed as the collision algorithm
  of RayShapes correctly calculates the contact normal for a while now.

Fixes #25227.
2019-02-19 11:16:05 +01:00
Rémi Verschelde 049bb75f9e
Merge pull request #26014 from AndreaCatania/bugfix
Fixed area collision report with concave
2019-02-18 15:24:09 +01:00
Andrea Catania 66420aea9c Fixed area collision report with concave 2019-02-18 14:15:27 +01:00
Rémi Verschelde f023e40f6e
Merge pull request #26011 from AndreaCatania/bugfix
Added support to scale areas, fixes #23448
2019-02-18 13:21:02 +01:00
Andrea Catania 90d05cbe30 Added support to scale areas 2019-02-18 12:57:55 +01:00
Rémi Verschelde 13c50e8aa5
Merge pull request #25481 from hpvb/fix-ubsan-asan-reports
Fix many asan and ubsan reported issues
2019-02-12 12:21:01 +01:00
Aaron Franke 3f837d5cc5 [Core] Rename Matrix3 file to Basis
The code already referred to "Basis", it's just the file name that was different for some reason.
2019-02-09 14:42:23 -05:00
Daniel Abbott b3c0cb08b0 Disable BT_DEBUG, works around #25476 and #25431 2019-02-08 11:11:01 +01:00
Marc Gilleron bd9f92cdf8 Implemented terrain raycast acceleration using Bresenham traversal and 1 level of chunks 2019-02-01 14:57:17 +01:00
Andrea Catania 5a26c7e0e5 Avoid inertia calculation for empty shape - Bullet 2019-01-30 10:33:33 +01:00
Hein-Pieter van Braam d308eb091a Fix many asan and ubsan reported issues
This allows most demos to run without any ubsan or asan errors. There
are still some things in thirdpart/ and some things in AudioServer that
needs a look but this fixes a lot of issues. This should help debug less
obvious issues, hopefully.

This fixes #25217 and fixes #25218
2019-01-30 06:43:56 +01:00
Andrea Catania 8d4617439c Fixed Rigidbody first frame center spawn 2019-01-28 08:30:26 +01:00
Rémi Verschelde 3e78a55e14 Bullet: Enable BT_DEBUG on debug builds
Fixes #25301.
2019-01-27 11:08:01 +01:00
Andrea Catania a9214bcee7 Fixed area overlaps if not move 2019-01-21 08:30:49 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde de4d7a785e Fix size in HeightMapShapeBullet::set_data 2018-12-27 10:29:25 +01:00
Daniel Abbott 572367552c `GodotRestInfoContactResultCallback::addSingleResult` now returns normal
`PhysicsDirectSpaceState.get_rest_info()` now provides normals in result
Addresses issue 24558
2018-12-22 19:26:18 -07:00
Rémi Verschelde 286f52c70a
Merge pull request #20745 from Zylann/heightmap_from_image
Allow to create a heightmap collision shape from an image
2018-12-09 23:08:51 +01:00
Rémi Verschelde 78cdbc54b0
Merge pull request #23994 from AndreaCatania/prec
Added function to control 6DOF precision
2018-11-28 10:30:47 +01:00
Andrea Catania a395d809a5 Added function to control 6DOF precision 2018-11-27 07:11:28 +01:00
Florian Jung e10c3e7ec5 Add more max-checking to physics queries
Fixes some out-of-bounds problems when there are more collisions than
have been requested for. This extends what has been done in 444b8471a3.

Fixes godotengine/godot#23990
2018-11-26 18:15:58 +01:00
Andrea Catania c6e6249143 Improved algorithm that check collision 2018-11-22 09:03:21 +01:00
Rémi Verschelde 5075e372f3
Merge pull request #23668 from sdfgeoff/fix_angular_constraints
Exposing more of bullets 6DOF spring constraints
2018-11-17 16:15:33 +01:00
Ibrahn Sahir d1550215b0 Fix some undefined behaviour in Bullet module.
Nulling mainShape when it's deleted to avoid double free.
Initialising vector in inertia calculation to work around bug in bullet.
2018-11-16 14:20:09 +00:00
Juan Linietsky 0b1e93ccd4 -Make sure monitorable cant be flipped while flushing queries, fixes #17330
-Also added set_deferred, this was missing.
2018-11-16 08:49:26 -03:00
Geoffrey Irons e149327be0 Added angular restitution
Adding angular and linear springs

Added getters
2018-11-13 09:24:00 +01:00
J08nY 56005772cd Fix multi-statement macro call not being covered. 2018-10-08 12:31:28 +02:00
Andrea Catania 15305ec91f Optimitzed area overlap checks 2018-10-07 07:14:38 +02:00
Andrea Catania 7d681274f8 Improved code that handles collision shapes, fixes #21945 2018-10-06 16:50:10 +02:00
Andrea Catania 5328dcb7bb Improved trimesh stability 2018-10-05 15:15:54 +02:00
Andrea Catania 62fc66291b Removed wrong equal vertex thresold to GJK solver 2018-10-05 10:51:24 +02:00