webaverse / app

Web metaverse client
https://app.webaverse.com
MIT License
338 stars 212 forks source link

Melee Combat Improvement #3661

Closed patriboz closed 1 year ago

patriboz commented 1 year ago

This PR introduces a few major changes:

Node based animations (avatars/animationHelpers.js) @gonnavis has implemented a WASM based animation system, which uses nodes. Instead of interpolating angles of joints on the three.js side, this system crossfades between nodes via physxworker.

Melee combat: Weapon collision based on weapon hitbox (character-hitter.js & game.js) Using a weapon will now query collisions based on weapon hitbox instead of object distance. Combos are defined as a component of weapons and can then be performed with successive mouse clicks.

Simple NPC combat AI (npc-manager.js) NPCs that wear a weapon will follow and attack/perform combos after activation.

Video

gonnavis commented 1 year ago

Please make a standalone "player can get hit" PR to master. ( Maybe combined with "simple NPC combat AI" codes, because of if not, we should have no good way to test "player can get hit" feature, but the npc ai logics need keep very simple in this PR, can improve it in another PR later ).

WASM animation and sword damageBox are already made in other PRs https://github.com/webaverse/app/pull/3160 , https://github.com/webaverse/app/pull/3257, and WASM animation is still a work in progress. I think they are not crucial for "player can get hit" feature, so don't include them.

patriboz commented 1 year ago

Please make a standalone "player can get hit" PR to master. ( Maybe combined with "simple NPC combat AI" codes, because of if not, we should have no good way to test "player can get hit" feature, but the npc ai logics need keep very simple, can improve it in another PR ).

WASM animation and sword damageBox are already made in other PRs #3160 , #3257, and WASM animation is still a work in progress.

Yes, that makes sense. I'll make a new PR with the standalone feature.