When reset_state was called on an existing AnimationBlendTree, the
output node would disappear, causing some errors in the editor and
preventing animations to play properly.
This change ensures the output node is always present in the node tree.
Segment collision results could be different depending on the direction
when they exactly touch (order of the points in segments). This was due
to the way parallelism was checked, using different logic based on
positive or negative sign of cross products.
Now the results are the same whatever the direction, without changing
the current design, which is that parallel or colinear segments are
not considered colinear.
Fixes inconsistencies with raycasts exactly on edges of convex shapes
depending on the direction.
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.
* Exposed functions in Engine to register and unregister singletons.
* Added the concept of user singletons, which can be removed (the system ones can't).
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).
One-way collision is disabled for both rigid bodies and character
bodies.
Kinematic margin is now applied to ray shapes to help getting consistent
results in slopes and flat surfaces.
Convex shapes don't return inverted normals when a segment test starts
inside (raycasting will be made consistent in a separate patch).
Ray shapes also discard contacts when fully contained inside a shape
and when the contact direction is inverted, so the behavior is
consistent with all shape types. Now they always separate only when
intersecting the top of a shape (for downward rays).