summaryrefslogtreecommitdiff
path: root/servers/physics_3d
AgeCommit message (Collapse)Author
2021-11-01Use `Callable` in Area monitor callbackrafallus
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
2021-09-22Port 2D improvement to move and slide 3Dfabriceci
Co-authored-by: Camille Mohr-Daurat <pouleyketchoup@gmail.com>
2021-09-21Add Get Center Method for Rect2/Rect2i and AABB.Anilforextra
2021-09-17Replace Vector3.to_diagonal_matrix with Basis.from_scaleAaron Franke
2021-09-16Clarify RigidDynamicBody modesPouleyKetchoupp
RigidDynamicBody modes are replaced with several properties to make their usage clearer: -lock_rotation: disable body's rotation (instead of MODE_LOCKED) -freeze: no gravity or forces (instead of MODE_STATIC and MODE_KINEMATIC) -freeze_mode: Static (can be only teleported) or Kinematic (can be animated) Also renamed MODE_DYNAMIC_LOCKED to MODE_DYNAMIC_LINEAR in the physics servers.
2021-09-16Merge pull request #52668 from qarmin/cppcheck_servers_physicsCamille Mohr-Daurat
Initialize variables in servers/physics
2021-09-15Merge pull request #52679 from nekomatata/world-boundary-shapeCamille Mohr-Daurat
Rename WorldMarginShape to WorldBoundaryShape
2021-09-15Initialize variables in servers/physicsqarmin
2021-09-14Rename WorldMarginShape to WorldBoundaryShapePouleyKetchoupp
2021-09-13Revert some URLs from the "Replace HTTP URLs with HTTPS" PRAaron Franke
2021-09-06Optimize raycast with large Heightmap shape dataPouleyKetchoupp
Port raycast accelerator from Bullet's btHeightfieldTerrainShape.
2021-09-06Proper support for custom mass properties in 2D/3D physics bodiesPouleyKetchoupp
Changes: -Added support for custom inertia and center of mass in 3D -Added support for custom center of mass in 2D -Calculated center of mass from shapes in 2D (same as in 3D) -Fixed mass properties calculation with disabled shapes in 2D/3D -Removed first_integration which is not used in 2D and doesn't seem to make a lot of sense (prevents omit_force_integration to work during the first frame) -Support for custom inertia on different axes for RigidBody3D
2021-09-06Merge pull request #52271 from nekomatata/query-layer-default-maskCamille Mohr-Daurat
Harmonize default value for collision mask in ray/shape queries
2021-08-31Add AnimatableBody inherited from StaticBody for moving platformsPouleyKetchoupp
Instead of having a physics node named Static that can be either Static or Kinematic, AnimatableBody is added again as a separate node: -Inherited from StaticBody to make its usage clearer -Still separated from CharacterBody to make its usage more focused Properly implemented constant velocity for kinematic bodies in godot physics servers (induced velocity without actually moving). Also updated description for the different physics nodes to make their usage clearer.
2021-08-31Merge pull request #49471 from nekomatata/body-state-sync-callbackJuan Linietsky
Clean physics direct body state usage in 2D and 3D physics
2021-08-30Harmonize default value for collision mask in ray/shape queriesPouleyKetchoupp
The default mask for queries was 0, 0x7FFFFFFF or 0xFFFFFFFF depending on the cases. Now always using 0xFFFFFFFF (in the form of UINT32_MAX to make it clear) in order to use all layers by default.
2021-08-28Merge pull request #52070 from nekomatata/area-point-gravity-fixFabio Alessandrelli
Fix point gravity calculation
2021-08-27Optimize area detection and intersect_shape queries with concave shapesPouleyKetchoupp
Whenever contact points are not needed, collision checks with concave shapes (triangle mesh and heightmap) stop at the first colliding triangle.
2021-08-27Merge pull request #51896 from nekomatata/restore-ray-shapeCamille Mohr-Daurat
Refactor RayShape and rename to SeparationRayShape
2021-08-26Merge pull request #51801 from nekomatata/area-one-directional-layer-checkCamille Mohr-Daurat
One-directional layer check for Area vs. RigidBody/SoftBody/Area
2021-08-25Clean physics direct body state usage in 2D and 3D physicsPouleyKetchoupp
Use a C++ callback instead of Callable for synchronizing physics nodes' state with physics servers. Remove usage of PhysicsDirectBodyState in physics nodes when not necessary. Store PhysicsDirectBodyState for bodies individually instead of a singleton to avoid issues when accessing direct body state for multiple bodies. PhysicsDirectBodyState is initialized only when needed, so it doesn't have to be created when using the physics server directly. Move PhysicsDirectBodyState2D and PhysicsDirectBodyState3D to separate cpp files.
2021-08-24Rename RayShape to SeparationRayShapePouleyKetchoupp
Makes it clearer that it's used for special cases when picking a collision shape.
2021-08-24Rename slips_on_slope to slide_on_slopePouleyKetchoupp
Also added some precision to the documentation.