Commit graph

7 commits

Author SHA1 Message Date
PouleyKetchoupp
7032cf0637 Fix RigidDynamicBody gaining momentum with bounce
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-25 09:51:57 -07:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
PouleyKetchoupp
3d1c123d45 Separate space override modes for gravity/damping in Area
Also make inspector clearer for gravity point properties.
2021-11-09 10:29:24 -07:00
PouleyKetchoupp
fc8c766ef9 Expose local center of mass in physics servers
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-08 16:17:57 -07:00
PouleyKetchoupp
daf7dcac7a Improved RigidDynamicBody linear/angular damping override
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-25 18:22:12 -07:00
PouleyKetchoupp
c1577e5a3f Fix 2D center of mass not updated from transform
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-19 16:22:30 -07:00
PouleyKetchoupp
cc39dca9f7 Rename Godot Physics classes from *SW to Godot*
Also moved MT physics server wrappers to the main servers folder, since
they don't have to be implementation specific.
2021-10-18 17:01:10 -07:00
Renamed from servers/physics_3d/body_3d_sw.h (Browse further)