Prismic247 / ScaledColliderSystem

Scaled Collider System prefab for VRChat worlds, to allow for player interactions with world colliders that are scaled relative to your avatar size.
https://prismic247.github.io/ScaledColliderSystem/
MIT License
9 stars 0 forks source link

Bouncing movement atop scaled colliders #1

Open Shardro opened 1 month ago

Shardro commented 1 month ago

I added the prefab to a test world and created a World Parent object that contains only the floor and a few pieces of primitive geometry. After shrinking my player character, walking on the floor causes the character to bounce uncontrollably and occasionally be flung off high into the air. The effect seems to be exaggerated the smaller the player is. In the attached gif, the player height is set to 0.7 and I am simply walking and slowly turning. I am not trying to jump. This problem does not appear to happen if the player is scaled up rather than down.

As this solution works by moving a set of scaled colliders relative to the player, I wonder if this could be caused by the player collider moving down and the world colliders moving up at the same time, causing them to overlap and be pushed apart and resulting in a feedback loop.

e8cbe4307b8e5b84b8205d5964a46272

Here is the same issue again, this time at player height 0.5, viewed through the physics debugger with a stationary scene camera.

66a28a6987e187f4d174801c84b51579

This is a very promising solution. Is there anything that can be done to mitigate this issue in the current version?

Thanks.

Shardro commented 1 month ago

An addendum to the above. This seems to be primarily an issue in editor and is smoothed out significantly once built. However, it's still a bit glitchy when walking up a step. This still causes a bounce, and if there is a ceiling above, it is possible to get stuck in it.

See how, in this gif, walking up a small step launches me up at the ceiling.

18547b105ac274bdb8601d585bb22769

Prismic247 commented 4 weeks ago

Apologies, for some reason I didn't receive a notification for this.

Without access to the character controller, there's little that can be done to mitigate the issue at present. The entire system itself is a hack, and this is the main bug when scaling down. A proper solution however is allegedly in the works from VRChat themselves: https://feedback.vrchat.com/udon/p/new-character-controller-for-worlds

DeaconDP commented 3 weeks ago

Ah, I had the exact same trouble. Nicely documented @Shardro .

For anyone reading this in the future, my solution was to scale up the entire world by 5.3333 x, then run my smaller-scale physics and colliders at regular (1.6m) scale. Using the PlayerAPI, you can specify walk, run, strafe, jump impulse, and gravity to hide the fact that every player is 5.3x larger than they normally are on spawn. image

Nice idea, @Prismic247 , but I wasn't able to avoid having those ghost colliders clip into the player's capsule collider and result in a big collision.