Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
195 stars 9 forks source link

Dynamic bone colliders scale incorrectly with users #845

Closed shiftyscales closed 3 years ago

shiftyscales commented 4 years ago

Steps to replicate:

On exiting the avatar anchor, the dynamic bone colliders on your avatar will be really big/tiny depending on which direction the anchor was scaled. If the anchor was made smaller, the collider ranges will be larger, and if the anchor is made bigger, the collider ranges will be smaller.

I believe this is also the source of #806 as lasers will not work correctly to grab because you are grabbing your own dynamic bone chains instead physically, overriding the laser grabbing.

shiftyscales commented 4 years ago

Credit to DeleriousJax for notifying me of this relationship/cause.

Frooxius commented 4 years ago

If I understand this correctly, the size of the colliders essentially gets stuck after you exit the anchor? If you visualize the colliders, does it show there as well?

What if you make sure the user is parented under the world root and you reset their scale, does it fix the issue?

H3BO3 commented 4 years ago

I've seen this happen at other times than just anchors (but that seems to be one of the more reliable ways to replicate). It seems to be related to scaling in general. Respawning has no effect.

shiftyscales commented 4 years ago

It shows on the collider visuals as well. and it isn't actually that they get stuck, rather like they over-compensate in their scale when resetting your size.

It appears to happen when the anchor is set to use the local space of the anchor. From initial testing, I couldn't get it to replicate with the other modes (anchor was a box inside of the world's root, so both worldspace, and parent space would didn't scale me when I entered the anchor.

The dynamic bones do not appear to change in size until after you exit the anchor, and the amount they grow/shrink is proportional to the scale difference. E.g. if the anchor is 0.5x scale, the dynamic bones will be 2x their usual size on exiting from the anchor.

https://youtu.be/58jpskbAVq0

H3BO3 commented 4 years ago

I've made an important discovery regarding the times I've seen dynamic bone colliders just seemingly being huge on my own avatar. It has to do with the scale of the host - If the host's user scale is excessively small, the dynamic bone colliders on anyone who joins the session at that time become oversized in a similar manner as Shifty described - I made the connection when I remembered the host is technically the user who loads the avatar. I am unsure if this applies to respawning while the host is various sizes.

Hayden-Fluff commented 3 years ago

I'm still encountering issues with this with a personal project and ends up getting to the point where I have to respawn the avatar because the colliders make everything un-grabbable.

H3BO3 commented 3 years ago

@Hayden-da-Serg As a stopgap, are you able to set the bone chain grab priority to -1 or something?

chemicalcrux commented 3 years ago

This may be a coincidence. If you adjust any of the settings on the individual bones (anything in the DynamicBoneChain's bone list), your dynamic bones (turn the VisualizeBones option on to see) will resize to compensate for the global scale of the slot the DynamicBoneChain is on. This also happens if you disable and enable the component.

Shrink yourself down and toggle the chain on and off, and the bones should grow.

It looks like that entering or leaving an anchor whose transform space is NOT the target user's space also causes the bone radii to update.

Any anchor satisfying this condition that anchors or releases you at small or large size will cause the bug to happen. I do not see any relation between the anchor changing size and the bug occurring. And, more generally, this is just one way to trigger the bug; the underlying problem is that the bone radius is absolute, not relative.

Getting moved from one space to another (e.g. reparenting yourself from the world root to an empty slot) also causes this update, so it probably has nothing to do with anchors at all.

Frooxius commented 3 years ago

Ok this should be fixed now in 2021.3.5.176. I was simply using the wrong compensation value, so it was fortunately an easy fix. Sorry it took so long!