summaryrefslogtreecommitdiff
path: root/servers/physics_3d
AgeCommit message (Collapse)Author
2021-11-23Rename `remove()` to `remove_at()` when removing by indexLightning_A
2021-11-22Add wakeup() conditional if previous gravity was 0Brennen Green
2021-11-20Add area to moved list when changing monitorable,Marcel Admiraal
and only remove area from query when deleting pair if it was monitorable.
2021-11-18Merge pull request #55074 from nekomatata/fix-soft-body-gravityRémi Verschelde
2021-11-17Fix applied gravity on soft bodiesPouleyKetchoupp
Regression fix, gravity was accumulated between frames after some changes around area gravity calculation. Also got rid of unused member and method in soft body class.
2021-11-17Fix contact generation with backface collision disabledPouleyKetchoupp
Replaced the previous implementation for backface collision handling (in test_axis function from SAT algorithm) with much simpler logic in the collision generation phase with face shapes, in order to get rid of wrong contacts when backface collision is disabled. Now it just ignores the generated collision if the contact normal is against the face normal, with a threshold to keep edge contacts. Added a special case for soft bodies to invert the collision instead of ignoring it, because for now it's the best solution to avoid soft bodies to go through concave shapes (they use small spheres). This might be replaced with a better algorithm for soft bodies later.
2021-11-17Fix rest_info returning no result with high margin and low motionPouleyKetchoupp
Apply the same logic as in test_body_motion to make sure the minimum allowed depth doesn't filter out all contacts in this case.
2021-11-16Merge pull request #55036 from nekomatata/bvh-fix-updateCamille Mohr-Daurat
Fix physics BVH pairing for teleported or fast moving objects
2021-11-16Fix physics BVH pairing for teleported or fast moving objectsPouleyKetchoupp
Updating the broadphase to find new collision pairs was done after checking for collision islands, so it was working in most cases due to the pairing margin used in the BVH, but in case of teleported objects the narrowphase collision could be skipped. Now it's done before checking for collision islands, so we can ensure that broadphase pairing has been done at the same time as objects are marked as moved so their collision can be checked properly. This issue didn't happen in the Octree/HashGrid because they do nothing on update and trigger pairs directly when objects move instead.
2021-11-16Rename built-in `SGN()` macro to `SIGN()`Hugo Locurcio
This matches the name of the GDScript function (except it's uppercase here).
2021-11-11Merge pull request #54810 from nekomatata/area-separate-override-modesCamille Mohr-Daurat
Separate space override modes for gravity/damping in Area
2021-11-10Add raycast options to hit when starting inside / hit back facesPouleyKetchoupp
Makes the results consistent for all shape types with options to set the desired behavior.
2021-11-10Fix errors in CharacterBody when floor is destroyed or removedPouleyKetchoupp
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-09Separate space override modes for gravity/damping in AreaPouleyKetchoupp
Also make inspector clearer for gravity point properties.
2021-11-08Merge pull request #54134 from nekomatata/body-center-of-mass-localCamille Mohr-Daurat
Expose local center of mass in physics servers
2021-11-08Expose local center of mass in physics serversPouleyKetchoupp
Center of mass in body's local space is more useful than the transformed one in some cases, like drawing its position for debug. It's especially useful to get the generated local center of mass when in auto mode (by default). Physics Server BODY_PARAM_CENTER_OF_MASS: Now always returns the local center of mass, instead of setting a local center of mass and getting a transformed one. This causes compatibility breaking, but it makes more sense for the parameter to be consistent between getter and setter. Direct Body State: There are now two properties, because both of them can be useful in different situations. center_of_mass: relative position in global coordinates (same as before) center_of_mass_local: position in local coordinates
2021-11-08Merge pull request #54486 from ibrahn/thread-work-pool-lazierRémi Verschelde
2021-11-05Rename AABB `get_area` to `get_volume`Brian Semrau
2021-11-05Merge pull request #54642 from BoilingFusion/masterCamille Mohr-Daurat
Fix the volume calculation for cylinders
2021-11-05Fix the volume calculation for cylindersJulian Adamse
2021-11-04Use parameter classes instead of arguments for all physics queriesPouleyKetchoupp
Same as what is already done for shape queries, applied to point and ray queries. Easier to document and more flexible to add more parameters. Also expose intersect_point method to script in 3D. Remove intersect_point_on_canvas in 2D, replaced with a parameter.
2021-11-01Use `Callable` in Area monitor callbackrafallus
2021-11-01ThreadWorkPool no longer starts worker threads if given zero work.Ibrahn Sahir
2021-11-01Merge pull request #37880 from nekomatata/rigid-body-damping-overrideCamille Mohr-Daurat
Improved RigidDynamicBody linear/angular damping override
2021-10-28clang-format: Various fixes to comments alignment from `clang-format` 13Rémi Verschelde
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28clang-format: Disable alignment of operands, too unreliableRémi Verschelde
Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
2021-10-25Improved RigidDynamicBody linear/angular damping overridePouleyKetchoupp
Damping values are now non-negative. Add new properties linear_damp_mode and angular_damp_mode to set the way RigidDynamicBody and PhysicalBone (2D & 3D) use damping values. It can now be Combine (default) to add to the default/areas, or Replace to override the value completely (current behavior).
2021-10-25Refactored Node3D rotation modesreduz
* Made the Basis euler orders indexed via enum. * Node3D has a new rotation_order property to choose Euler rotation order. * Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations. The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-21Fix RigidDynamicBody collision update after changing collision layer/maskPouleyKetchoupp
Changing the collision layer of a sleeping body was not triggering area updates correctly. Bodies need to be active for collision to be checked against already overlapping bodies and areas. Neighbors need to be activated too in order to handle the case where a static body is modified (it can't be activated directly but paired bodies need to check their collision again). In 3D, moved the call to wakeup() from the physics server to GodotBody3D::_shapes_changed to make it consistent with 2D and also handle the case where shapes are modified (_shapes_changed is called in both this case and collision layer changes).
2021-10-21Fix SoftDynamicBody3D crash when setting disable modePouleyKetchoupp
Proper logic for changing physics state when disabled and disabled mode is changed (it was unnecessarily making calls to re-initialize physics). Extra error handling in soft body implementations to avoid crashes with invalid mesh.
2021-10-19Fix 2D center of mass not updated from transformPouleyKetchoupp
Same logic as what was done in 3D, applied to 2D center of mass. Also did some minor cleanup in 3D and fixed center of mass transform during the first frame after teleporting a dynamic body.
2021-10-18Rename Godot Physics classes from *SW to Godot*PouleyKetchoupp
Also moved MT physics server wrappers to the main servers folder, since they don't have to be implementation specific.
2021-10-15Swap args of Plane(point, normal) constructormennomax
Now (normal, point)
2021-10-05Merge pull request #53420 from nekomatata/fix-tilemap-moving-platformRémi Verschelde
2021-10-04Merge pull request #53365 from danger-dan/wakeup_fixCamille Mohr-Daurat
Use wakeup() function to wake sleeping bodies on impulse, force and velocities. Fix for PR #52967
2021-10-05Changed from directly waking bodies to using the wakeup() functions in ↵Daniel
direct body state changes (forces, impulses and veloicities). this 'bug' was introduced in PR #52967 added wakeup to 2d direct body
2021-10-04Fix physics glitch with TileMap moving platformsPouleyKetchoupp
Added a parameter in test_body_motion to exclude attached objects from collision, used to avoid collision with all TileMap tiles with moving platform motion instead of just the one tile the character touches. Same changes made in 3D for consistency, and handling potential similar cases.
2021-10-04Merge pull request #53280 from nekomatata/test-body-motion-parametersRémi Verschelde
2021-10-04Script interface improvements for test body motionPouleyKetchoupp
-Physics servers test body motion use a class to hold parameters instead of multiple arguments to make it more readable and flexible since there are many options -Improved documentation for test body motion and kinematic collision -Removed read-only properties for body motion results (not handled in scripts, so they should be get_ methods only instead)
2021-10-04Fix crashes with pinned vertices in GodotPhysics Soft BodyPouleyKetchoupp
2021-10-04Fix crash when pinned SoftBody point is out of rangeHaoyu Qiu
2021-10-01Remove scene code in physics serversPouleyKetchoupp
Replaced Mesh with mesh RID in Godot Physics 3D and Bullet.
2021-09-30Use range iterators for `Map`Lightning_A
2021-09-30Remove shape metadata from 2D physics serverPouleyKetchoupp
Shape metadata was only used to get tile information when colliding with tilemaps. It's not needed anymore since there's an API in tilemap using body ids instead.
2021-09-29Rename RID's `getornull()` to `get_or_null()`Hugo Locurcio
2021-09-29Don't memcpy to nullptr even if length is zeroHaoyu Qiu
2021-09-28Merge pull request #52754 from nekomatata/dynamic-body-modesCamille Mohr-Daurat
Clarify RigidDynamicBody modes
2021-09-28Merge pull request #52953 from nekomatata/fix-collision-recovery-depthRémi Verschelde
2021-09-27Improved logic for CharacterBody collision recovery depthPouleyKetchoupp
Allows 2D character controller to work without applying gravity when touching the ground (also more safely in 3D), and collision detection is more flexible with different safe margin values. Character body motion changes in 2D and 3D: -Recovery only for depth > min contact depth to help with collision detection consistency (rest info could be lost if recovery was too much) -Adaptive min contact depth (based on margin) instead of space parameter Extra CharacterBody changes: -2D: apply changes made in 3D for stop on slope and floor snap that help fixing some jittering cases -3D: fix minor inconsistencies in stop on slope and floor snap logic
2021-09-24Added set_active(true) to all body direct state force apply/impulses. #52915Daniel