ExtendRealityLtd/Tilia.Trackers.PseudoBody.Unity

Smooth Collisions

Closed this issue · 11 comments

Is your feature request related to a problem?

I'm always frustrated when I come close to a wall and suddenly I teleport 5 feet away, or go lean to grab an object and I start getting a seizure.

Describe the solution you'd like

Id like to make it work like most other VR games, it just stops you without needing to teleport you away, like a physics collision.
No jitter, just normal collisions.

Describe alternatives you've considered

I could not find an alternative that worked.

Additional context

I feel like this should already be a thing, but the brain dump clearly shows the jitter too.

What do you have your Source Thickness on the Pseudo Body Facade set to?

The earliest value I can remember was 0.25, but it had the jitter + some strange collision issues when it came to stairs so for a long time iv been using 0.45.

Values such as 0.15 make it nearly perfectly smooth but cause the player to get stuck in geometry that intersects (such as the edge between a wall and the floor).
Sometimes the player cant even escape after getting stuck, though I can get around that with the sprinting mechanic I added to my game.

Try the default value of 0.205, that shouldn't have any jitter.

If you're trying to move up stairs, you're better off having a fake slope collider than attempting to move a user directly up a 0.45 y position in VR. most games fake stairs with a slope collider.

I attempted 0.205 and the jitter was still there (though admittedly it was far lesser), what concerns me about this value though is the fact that the player cannot use ramps, he just floats away like there's an invisible floor.
https://cdn.discordapp.com/attachments/716792975228665868/738545784479285308/ezgif.com-gif-maker.webp

I have continued to test and found that matching the source thickness directly with the character controller radius removed nearly all stutter. I must mention however that one eye has the stutter while the other one does not, the right eye to be specific.

I have reason to believe that the following code is the one causing the player to float away.

PseudoBodyProcessor.cs
// Handle walking down stairs/slopes and physics affecting the Rigidbody in general.
            Vector3 rigidbodyPhysicsMovement = PhysicsBody.position - previousRigidbodyPosition;
            if (Interest == MovementInterest.Rigidbody || Interest == MovementInterest.RigidbodyUntilGrounded)
            {
                previousCharacterControllerPosition = Character.transform.position;
                Character.Move(rigidbodyPhysicsMovement);

                if (Facade.Offset != null)
                {
                    Vector3 movement = Character.transform.position - previousCharacterControllerPosition;
                    Facade.Offset.transform.position += movement;
                    Facade.Source.transform.position += movement;
                }
            }

Sadly I am, as you can probably tell, not the most capable individual and as such, I don't really know what to do from this point onward. From what I can tell, the grounding "stickiness" should be increased to handle more radical angles.

I will continue to blindly make edits to see if I can get something to click.

More details per request of Ethan:
Character Setup
https://cdn.discordapp.com/attachments/716792975228665868/740661702617727030/unknown.png
https://cdn.discordapp.com/attachments/716792975228665868/740661655339270215/unknown.png

Collider Parameters
https://cdn.discordapp.com/attachments/716792975228665868/740662103614160906/unknown.png
Note: I measured it and it turned out to be a 20 degree angle ramp instead of 45.

UPDATE: Fixed flickering, the issue was using multipass.

I attempted 0.205 and the jitter was still there (though admittedly it was far lesser), what concerns me about this value though is the fact that the player cannot use ramps, he just floats away like there's an invisible floor.
https://cdn.discordapp.com/attachments/716792975228665868/738545784479285308/ezgif.com-gif-maker.webp

the current axis move is based on Transform Property Applier,
but the pseudo body is using physics when grounded.
as soon as the player use axis move to walk downhill, the transform apply is moving it forward on x-z plane,
then the pseudo body think he is now airborne, gravity works but the velocity was small so it is like floating.
axis move continuously transform apply forward, gravity will eventually catch up and make him grounded.
thus losing the downward velocity.
the overall result is the player seems dropping slowly while walking downhill.

Edit: even if the axis move uses physics add force, i think it will not fix this issue, as long as the axis move is only moving it on x-z plane

Edit: even if the axis move uses physics add force, i think it will not fix this issue, as long as the axis move is only moving it on x-z plane

I agree with this assessment, it appears that the axis move is causing the issue here.
when I force airborne on ramps the problem nearly solves itself (even if it's not smooth).

It seems I never updated this, so might as well.

The flickering is not solved, it only works on single-pass while in-engine. Builds still showcase the flickering.
I believe it might also be related to (this) but I'm not 100% sure.
(The behaviour is similar for the player's hands + grabbed objects but it also affects the camera and possibly collision detection).

Force airborne does not alleviate smoothness problems (same flickering as before) when moving against walls.

I can confirm it is ExtendRealityLtd/VRTK#1992.

I have moved the issue to https://github.com/ExtendRealityLtd/VRTK/issues/2113 since its now outside the scope of this issue.