Neos-Metaverse / NeosPublic

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

Split Capsule Character Controller #2534

Open Hayden-Fluff opened 3 years ago

Hayden-Fluff commented 3 years ago

Is your feature request related to a problem? Please describe.

The current method for handing character collision with the capsule collider does not really work all that well for full body users, the ground projected root positioning does not properly allow users to lean over objects that have a character collider.

This has lead to cases where I either get pushed out of the object I'm trying to lean over, or just out right fall straight into it.

Describe the solution you'd like

I was talking with @Coffee-Maker about a better way of handling this, and he mentioned a split capsule collider, so I did a bit of thinking and thought of a potential change to character controller collisions.

The character controller capsule should be split into two different capsules for upper and lower body collisions with the height of the capsules based on the distance from the head to the hips and from the hips to the feet.

I've put together a really quick model of how it may look in a video in the Additional Context section.

Describe alternatives you've considered

One thing I considered is that in the presence of Full Body, the character controller would be positioned at either ground projected hips or feet.

Additional context

This would not only allow for better ability to lean over objects, but this would also allow for colliders to accurately represent the current avatar pose, for instance if someone were laying down the capsules would be flat against the ground, or if someone crouched down they would be able to fit under character colliders they'd not normally be able to while standing.

Many other users in the Discord server also appear to be for this idea, as they have also ran into cases as mentioned above.

Neos' current handling of the Character Controller Capsule: https://storage.googleapis.com/haydens-video-storage/Neos%20Github%20Videos/Neos%20Character%20Controler%20Capsule%20Handling.mp4

My proposed Split Capsule Character Controller handling: https://storage.googleapis.com/haydens-video-storage/Neos%20Github%20Videos/Proposed%20Split%20Capsule%20Handling.mp4 This is only visual for demonstration purposes

World link to the model shown in the videos above: neosrec:///U-Hayden/R-af864b6e-fa88-4b99-a89d-4efb9168309e Can be switched between either default or Split Capsule visual via context menu.

Link to discussion in the Neos Full Dive channel in Discord: https://discordapp.com/channels/402159838827905024/731903736028332083/858739462841958401

Frooxius commented 3 years ago

We wouldn't likely do this to the default character controller, as it could break some existing things. If leaning over in full body is problem, that can actually be solved by posing the capsule at feet, rather than at head, which is much simpler solution.

This might be better handled by instead adding more general system for representing the user with multiple colliders, that way you can actually more accurately model the rest of the body, including arms and legs and give more flexibility or set it up in some other ways that suit your application.

Doing this is a bit tricky though, it'll require extending the character controller to handle multiple colliders and tracking of supports properly, which currently assumes a singular collider that's always upright (meaning just having two wouldn't help on its own, as they don't tilt based on the body orientation, so lying down would be as if you were still standing upright).

shiftyscales commented 3 years ago

There are definitely other use cases that have come up that would be handled well by having multiple character conteoller colliders, e.g. stepping up onto a ledge/raised surface in full body, straddling an object so one's feet aren't hovering, etc.

For an easier/shorter term fix however, using feet positioning for the capsule collider would greatly resolve a large number of cases I've seen this issue arrise.

Hayden-Fluff commented 3 years ago

I fully expect this to be more of a long term implementation even if it'll be implemented at all, (probably something to look at after Bepu v2 is implemented) though I feel at least switching the root to be at the feet position in the presence of full body would work as a suitable tweak for the time being.

Hayden-Fluff commented 3 years ago

There'd also probably ideally be an option to enable legacy behavior if this or something like this ever does get implemented. That would allow for existing content to keep the current behavior or if desired allow users to use the legacy behavior.

alexderpyfox commented 3 years ago

Is the capsule collider moveable in-game? Someone told me i should comment this here

Hayden-Fluff commented 3 years ago

Are there any plans to address this soon? Bepu v2 makes it very infuriating to lean over objects now.

A good example I mentioned previously is in maps like Cabin of the Seasons, where you'd want to very commonly lean over something to pick up an object, previously you could sort of ram through the collider and hope it'd work, but now this is practically impossible, currently the only way to lean over objects is to have to resort to a non-physical locomotion mode, such as no-clip or teleport (which is not an option in such maps) or having to grip onto the collider, which also is not an option in this case.

Leaning over objects with character colliders is now not possible, and is quite annoying.

Frooxius commented 3 years ago

Currently BEPUv2 is a single capsule shape, which is same as it was with BEPUv1, there was no change made in that regard.

You can find what's planned on the Physics roadmap: https://github.com/Neos-Metaverse/NeosPublic/projects/19#card-66111722

Specifically for this implementing compound colliders is a pre-requisite that might enable this to be implemented. I might add it pretty soon, but I can't make any promises on that point yet, currently I'm focusing on cleaning up more bugs and a few other things from the roadmap.