summaryrefslogtreecommitdiff
path: root/servers/physics_server_3d.cpp
AgeCommit message (Collapse)Author
2023-02-12Fix return type for collide_shape to use PackedVector3ArrayAnthony Cossins
2023-01-31Create default World physics spaces on demand onlysmix8
Changes that the default physics spaces of World resources are only created on first use.
2023-01-29Replace Area gravity point distance scale with unit distanceAaron Franke
2023-01-29Remove deprecated AREA_PARAM_GRAVITY_POINT_ATTENUATIONAaron Franke
2023-01-06Merge pull request #68429 from KoBeWi/PropertySettingsRémi Verschelde
Add PropertyInfo overload for GLOBAL_DEF
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-23Bind methods related to disabling collision between joint bodiesMikael Hermansson
2022-12-11Add PropertyInfo overload for GLOBAL_DEFkobewi
2022-11-23Update remaining physics exclude parameters to use TypedArrayRicardo Buring
Also update the documentation to refer to the get_rid() method.
2022-10-31Change exclude property in `PhysicsRayQueryParameters3D` to TypedArrayRaul Santos
Change type of exclude property from `Vector<RID>` to `TypedArray<RID>` which is consistent with the 2D version.
2022-10-05Bind PhysicsDirectBodyState3D::get_inverse_inertia_tensorMikael Hermansson
2022-09-25Add `area_get_collision_layer` and `area_get_collision_mask`Mansur Isaev
2022-09-07Expose registration of physics servers to GDExtensionRicardo Buring
This exposes PhysicsServer2DManager and PhysicsServer3DManager.
2022-08-26Restore RigidBody2/3D, SoftBody names in physicsfabriceci
2022-08-23Replace Array return types with TypedArray 2kobewi
2022-08-18Add collision weight to PhysicsBody for penetrations must be avoidedSilc Renew
Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2022-06-10Add static methods to create RayQueryParameterskobewi
2022-05-19Use range iterators for RBSet in most casesAaron Record
2022-05-19Add dedicated macros for property name extractionHaoyu Qiu
* Replace case-by-case extraction with PNAME & GNAME * Fix group handling when group hint begins with property name * Exclude properties that are PROPERTY_USAGE_NO_EDITOR * Extract missing ADD_ARRAY*, ADD_SUBGROUP* macros
2022-05-18Add motion parameter to toggle whether recovery is reported as a collisionRicardo Buring
This makes the intent explicit in each use case.
2022-05-16Replace most uses of Map by HashMapreduz
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
2022-05-03Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`Hugo Locurcio
These typedefs don't save much typing compared to the full `Ref<Resource>` and `Ref<RefCounted>`, yet they sometimes introduce confusion among new contributors.
2022-03-15Create GDExtension clases for PhysicsServer3Dreduz
* Allows creating a GDExtension based 3D Physics Server (for Bullet, PhysX, etc. support) * Some changes on native struct binding for PhysicsServer This allows a 3D Physics server created entirely from GDExtension. Once it works, the idea is to port the 2D one to it.
2022-02-14Validate PhysicsDirectSpaceState{2,3}D::_intersect_point inputHaoyu Qiu
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-10Improve RigidDynamicBody force and torque APIPouleyKetchoupp
Makes the API for forces and impulses more flexible, easier to understand and harmonized between 2D and 3D. Rigid bodies now have 3 sets of methods for forces and impulses: -apply_impulse() for impulses (one-shot and time independent) -apply_force() for forces (time dependent) applied for the current step -add_constant_force() for forces that keeps being applied each step Also updated the documentation to clarify the different methods and parameters in rigid body nodes, body direct state and physics servers.
2021-12-07Add physics solver settings to project settingsPouleyKetchoupp
Helps with discovery and setup of physics solver settings, in a specific project settings section for both 2D and 3D. Other changes for cleanup: -Removed unused space parameters in 3D SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS -Added custom solver bias for Shape3D (same as Shape2D) -Improved documentation for solver settings
2021-12-03Update space parameters in 2D and 3DPouleyKetchoupp
Clarified space parameters for contacts and added missing ones. List of changes: -Add contact bias to space parameters -Add solver iterations to space parameters, instead of a specific physics server function -Renamed BODY_MAX_ALLOWED_PENETRATION to CONTACT_MAX_ALLOWED_PENETRATION to make it consistent with other contact parameters
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-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-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-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-09Fix missing argument names in bindingsRémi Verschelde
While at it, tweak some boolean setters to use `p_enabled` for the bool. Also renames `draw_minimap()` to `set_draw_minimap()`.
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-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-03Merge pull request #42364 from madmiraal/fix-39887Rémi Verschelde
2021-09-28Merge pull request #52754 from nekomatata/dynamic-body-modesCamille Mohr-Daurat
Clarify RigidDynamicBody modes
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-22Port 2D improvement to move and slide 3Dfabriceci
Co-authored-by: Camille Mohr-Daurat <pouleyketchoup@gmail.com>
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-14Rename WorldMarginShape to WorldBoundaryShapePouleyKetchoupp
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-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-24Rename RayShape to SeparationRayShapePouleyKetchoupp
Makes it clearer that it's used for special cases when picking a collision shape.
2021-08-24Fix CharacterBody motion with RayShapePouleyKetchoupp
Make separation ray shapes work properly in move_and_slide, wihtout the specific code in CharacterBody like before. Now most of the logic is handled inside the physics server. The only thing that's needed is to use ray shapes only for recovery and ignore them when performing the motion itself (unless we're snapping or slips on slope is on).
2021-08-24Restore RayShape as a regular shape typePouleyKetchoupp
Partial revert from previously removing ray shapes completely, added back as a shape type but without the specific character controller code.