Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
141 stars 2 forks source link

User spawn position offset when feet are not directly under user via locomotion animation system #3150

Open Zyro1331 opened 3 weeks ago

Zyro1331 commented 3 weeks ago

Describe the bug?

Feet Position is not a very reliable positional source to respawn from, and doesn't fully represent the bottom of a user's Character Collider anymore. Upon falling off a world and respawning, the Feet on a user will end up being far above where the center or base of their Character Collider, causing them to respawn under the ground and fall once again.

https://github.com/user-attachments/assets/b50982da-d5ef-4c66-9528-9b0f33642369

Other avatars experience this effect worse than others, so it will depend what avatar you pick before reproducing the issue.

To Reproduce

Here's a world I made to reproduce this issue easily, it has two ProtoFlux scripts and some text to further showcase the problem.

World URL: https://go.resonite.com/record/U-Zyro1331/R-401c57d1-9a48-491b-90ad-3bc20eaa4df2 Record URL: resrec:///U-Zyro1331/R-401c57d1-9a48-491b-90ad-3bc20eaa4df2

Expected behavior

Use GroundProjectedHead as a default Positional Source to pull from, as it works far better with the Character Collider on the Walk / Run Physical Locomotion module, and tends to be far more reliable at representing the "origin" point of a user.

Screenshots

No response

Resonite Version Number

Beta 2024.10.29.1229

What Platforms does this occur on?

Windows

What headset if any do you use?

Meta Quest 3 + SteamLinkVR

Log Files

MANGOVRG - 2024.10.29.1229 - 2024-10-31 13_33_50.log

Additional Context

This issue mostly pairs with #3144, as I discovered that Resonite's default respawning behaviour suffers from the same Feet offset issue my scripts had as well. The world linked to reproduce the bug above also has a ProtoFlux script that recreates a similar problem, where the Feet become largely offset after a major change in velocity, causing the user to stray far away from the intended spawn point (represented as a blue dot at the center of the world.)

https://github.com/user-attachments/assets/0813b97e-b076-4378-8837-fee6b9690b03

Reporters

@zyro1331

shiftyscales commented 3 weeks ago

We shouldn't tweak the default to mitigate the current selection misbehaving- we should instead fix the underlying issue, @Zyro1331.

Seeking input from @Frooxius or @BlueCyro - this has some relation to #3144 as noted- but also #2850 - effectively- the underlying issue at play here is that the locomotion animation system does not account for when the user is suddenly / instantaneously teleported.

Zyro1331 commented 3 weeks ago

While I do feel that something should be done to the Locomotion animation system to clamp the Feet Position, due note that as long as the feet are physically simulated in some way, it still won't be a great positional representation of a user's origin point.

Image

Here's a screenshot captured while falling, the green capsule represents the shape and size of the Character Collider. The Character Collider uses GroundProjectedHead as an origin point to positionally start from, and extends upwards to meet the user's head. When an avatar's feet are above the bottom of the Character Collider, it will cause respawning to place the Collider physically through the ground plane, rather than lightly on top of it. While the CharacterController usually sorts this out by raising the user upward until their Character Collider isn't intersecting through the floor, it's only beyond a certain point that the detection isn't possible, and said user falls through the ground once again.

Even if the Locomotion Animation system does get it's erratic foot position issue cleaned up, I still feel that falling through the floor will still be a problem when the feet are physically reacting to velocity. Changing the default setting for CommonSpawnArea to use GroundProjectedHead would likely be the most thorough option to help with this issue, since it follows the convention the Character Collider is already using to start with, and will completely stop the intersecting through the ground issue when respawning.

3x1t-5tyl3 commented 3 weeks ago

While I do feel that something should be done to the Locomotion animation system to clamp the Feet Position, due note that as long as the feet are physically simulated in some way, it still won't be a great positional representation of a user's origin point.

Image

Here's a screenshot captured while falling, the green capsule represents the shape and size of the Character Collider. The Character Collider uses GroundProjectedHead as an origin point to positionally start from, and extends upwards to meet the user's head. When an avatar's feet are above the bottom of the Character Collider, it will cause respawning to place the Collider physically through the ground plane, rather than lightly on top of it. While the CharacterController usually sorts this out by raising the user upward until their Character Collider isn't intersecting through the floor, it's only beyond a certain point that the detection isn't possible, and said user falls through the ground once again.

Even if the Locomotion Animation system does get it's erratic foot position issue cleaned up, I still feel that falling through the floor will still be a problem when the feet are physically reacting to velocity. Changing the default setting for CommonSpawnArea to use GroundProjectedHead would likely be the most thorough option to help with this issue, since it follows the convention the Character Collider is already using to start with, and will completely stop the intersecting through the ground issue when respawning.

Some more contex: This is an incredibly old issue at this point already; This was something we requested in [PREVIOUS PLATFORM] before and I still agree that it is the best option.

ModernBalloonie commented 1 week ago

So I was testing battle nights with Aegis Wolf, and it seems like the feet position if you're flung changes to something like this (the pink box representing the feet position using PositionAtUser). The feet position goes way off, so when you get teleported, your feet position gets set, but then you end up being way off when you get teleported. This feels like it's related to this. Image

Zyro1331 commented 1 week ago

So I was testing battle nights with Aegis Wolf, and it seems like the feet position if you're flung changes to something like this (the pink box representing the feet position using PositionAtUser). The feet position goes way off, so when you get teleported, your feet position gets set, but then you end up being way off when you get teleported. This feels like it's related to this. Image

Yep, this is exactly my issue I'm having while developing my game world too. I am unable to respawn users reliably due to this large offset issue.

Zyro1331 commented 1 week ago

If you need a quick band-aid fix for this problem in your own creations, I've managed to mitigate it by attempting to set the feet position a second afterwards, which usually is enough time for the feet animation to calm down. It isn't perfect but it has been reliable enough for me. Here's a demo of that fix being applied, if you look closely you can see the name tag of the user falling off the platform, before being reset once again.

https://github.com/user-attachments/assets/160c2e34-e0e4-48fd-874d-89274993aa59