app icon indicating copy to clipboard operation
app copied to clipboard

Ragdoll support for NPC(s).

Open gonnavis opened this issue 3 years ago • 12 comments

Fix: https://github.com/webaverse/app/issues/1891 Follow: https://github.com/webaverse/app/pull/2610 Sibling PR: https://github.com/webaverse/app-wasm/pull/36

https://user-images.githubusercontent.com/10785634/161391728-004c5a87-92fa-48c4-9ced-9f7dc067b404.mp4

https://user-images.githubusercontent.com/10785634/161393407-7f82ab21-c754-4842-89ce-6093daf816b2.mp4

The github compare https://github.com/gonnavis/app/compare/RagdollPr...RagdollNpcPr seems wrong. Compared to RagdollPr branch, only changed these codes:

image image image

gonnavis avatar Apr 02 '22 16:04 gonnavis

Another question: are the ragdoll bones theoretically movable by grabbing the avatar VRM bones to re-position? VR posing is a future feature and it would be nice if we can delegate the restitution logic for posing to the ragdoll bones system.

avaer avatar Apr 03 '22 07:04 avaer

We should also think hard about using xstate. We shouldn't just use it for ragdolls, but for everything (if that is the approach), otherwise the code would be really inconsistnet.

Yes I want to use xstate as state-manager for everything, especially character animation/combat system. I'll working on this afterwards.

So if we are using xtate we need to make sure it is fast for game loops (e.g we should know for a fact that it doesn't allocate any memory during the loop, because that will cause unfixable GC performance problems later). Do you have 100% confidence there is absolutely no allocations from reading the library's code, and allocations will never be added in the future?

If there is not 100% confidence in this fact we should not use this library.

I used xstate in my personal game project. I feel it's very powerful and handy, and the performance seems good. Each character in it built with a complex xstate state-machine,

But I really not sure whether it allocate any memory during the loop. I'll try to confirm by reading the source code and get help from the community.

gonnavis avatar Apr 03 '22 09:04 gonnavis

Another question: are the ragdoll bones theoretically movable by grabbing the avatar VRM bones to re-position? VR posing is a future feature and it would be nice if we can delegate the restitution logic for posing to the ragdoll bones system.

Yes, I think so. I'll try to make a demo.

gonnavis avatar Apr 03 '22 09:04 gonnavis

Hello @avaer, I feel I need more time to prove the performance of XState, I'll try in other PRs. So for this PR, I used state variables instead of XState. https://github.com/webaverse/app/pull/2731/commits/ceeedf4977d9722b330e00b4dcc62d721fcc2d6d

gonnavis avatar Apr 05 '22 13:04 gonnavis

Another question: are the ragdoll bones theoretically movable by grabbing the avatar VRM bones to re-position? VR posing is a future feature and it would be nice if we can delegate the restitution logic for posing to the ragdoll bones system.

Do you mean something like this? I added the grabbing logic in the commented codes for testing. https://github.com/webaverse/app/pull/2731/commits/591a6f73948a7d3593072ffcfc39301ae8571bff

https://user-images.githubusercontent.com/10785634/161782121-01dee374-a71c-4f2f-a1dc-e059c3ce8c0f.mp4

gonnavis avatar Apr 05 '22 14:04 gonnavis

Do you mean something like this?

Kind of! That demo is really cool!

I meant more being able to pose the avatar in a specific way (like moving the hands up, but keeping the spine in place to create a pose).

It looks like we might be able to do it, but it's probably best to ship this first and make that a separate PR.

avaer avatar Apr 14 '22 02:04 avaer

This PR need a rebase.

avaer avatar Apr 14 '22 02:04 avaer

@avaer Solved conflicts of this PR, and sibling PR too https://github.com/webaverse/app-wasm/pull/36 .

gonnavis avatar Apr 14 '22 09:04 gonnavis

Separated/Created ragdoll.js. https://github.com/webaverse/app/pull/2731/commits/2ec63f19407c2c0ada5d58618e1462e41aec843d

gonnavis avatar Apr 19 '22 07:04 gonnavis

A few more wasm-related comments.

avaer avatar Apr 21 '22 02:04 avaer

@gonnavis where we at with this? still needed, or been replaced?

lalalune avatar Jul 03 '22 03:07 lalalune

@gonnavis where we at with this? still needed, or been replaced?

Still needed, but need a lot of code structure refactor, and should be changed to z-targeting branch, I'll keep working on this.

gonnavis avatar Jul 03 '22 03:07 gonnavis

Closed in favor of https://github.com/upstreet-labs/app/pull/262

gonnavis avatar Nov 16 '22 17:11 gonnavis