summaryrefslogtreecommitdiff
path: root/servers/physics_3d/godot_body_3d.h
AgeCommit message (Collapse)Author
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-04-06Fix some issues found by cppcheck.bruvzg
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-11-25Fix RigidDynamicBody gaining momentum with bouncePouleyKetchoupp
Bounce calculation now uses the previous frame's velocity, so it's consistent with the actual motion of the bodies involved and not the yet-to-be-applied forces. When bounce is 1, using the current velocity was causing the new forces (including gravity) to be taken into account, which lead to the bounce velocity to be higher than the falling velocity at the moment of impact, adding more and more energy over time.
2021-11-23Rename `remove()` to `remove_at()` when removing by indexLightning_A
2021-11-09Separate space override modes for gravity/damping in AreaPouleyKetchoupp
Also make inspector clearer for gravity point properties.
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-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-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.