Age | Commit message (Collapse) | Author |
|
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
|
|
Changed the algorithm for solving contacts to keep previous contacts as
long as they are under the max separation threshold to keep contact
impulses more consistent and contacts more stable.
Also made 2D consistent with 3D and changed some default parameters:
-Contact bias is now 0.8 instead of 0.3 to avoid springy contacts
-Solver iterations are 16 instead of 8 by default for better stability
Performance considerations:
Tested with stress tests that include lots of contacts from overlapping
bodies.
3D: There's no measurable difference in performance.
2D: Performance is a bit lower (close to 10% slower in extreme cases)
The benefit for 2D physics to be much more stable outweighs the slight
decrease in performance, and this could be alleviated by changing the
algorithm to use jacobians for contact solving to help with cache
efficiency and memory allocations.
|
|
Fix uniform array alignment to fix a bug
|
|
|
|
|
|
|
|
`print_error()` should generally not be used directly. Also,
falling back is best done by printing a warning message instead
of an error message.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
AMD FidelityFX Super Resolution
|
|
|
|
volumetric fog on MoltenVK.
|
|
|
|
|
|
|
|
|
|
|
|
and only remove area from query when deleting pair if it was monitorable.
|
|
|
|
Fix Depth-Prepass transparency mode
|
|
Fix transparency state initialization
|
|
Add mising bits of implementation and ensure depth-prepass objects are
only rendered in the transparency pass.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
Add SHADER_IS_SRGB define to Vulkan renderer
|
|
|
|
Fix physics BVH pairing for teleported or fast moving objects
|
|
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.
|
|
This matches the name of the GDScript function (except it's uppercase
here).
|
|
|
|
|
|
|
|
|
|
|
|
Fix shader crashing when using `ALBEDO` or `ALPHA` in light function
|
|
Separate space override modes for gravity/damping in Area
|
|
|
|
Makes the results consistent for all shape types with options to set
the desired behavior.
|
|
|
|
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.
|
|
Also make inspector clearer for gravity point properties.
|
|
|
|
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
|