webaverse / app

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

Patriboz/melee combat #3663

Closed patriboz closed 1 year ago

patriboz commented 2 years ago

This PR introduces the following features:

Melee combat: LocalPlayer can get hit. 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 2 years ago

I encountered this error when npc first try to use sword, any idea ?

image image

patriboz commented 2 years ago

I encountered this error when npc first try to use sword, any idea ?

image image

I added logic for weapons without combos, so this should be fixed now.

avaer commented 2 years ago

These combo animations are still not finished (I think it's been bad like this for a year now).

zenkale commented 2 years ago

@patriboz I have identified 3 issues: 1-once we have a sword/silsword and we click for attack, One click makes a full swing happen(whole animation plays before player stops). Shouldn't it be like before? The attack should only be as long as we are clicking the left click? This make the combat very weird.

https://user-images.githubusercontent.com/111510128/188224982-c4b9545c-974f-4b98-bb23-b26396f6e0f0.mp4

2-Since we click once to attack, full attack animation plays before character is free again, we have no control over our character. We can not move it, we can not change its direction. As you can see in the video below, once we click attack it once, we are unable to change the direction, walk, run until that animation is finished.

https://user-images.githubusercontent.com/111510128/188225023-73a39dfa-0a6f-43cd-8982-33d2aaedbecf.mp4

3-Once we have equipped an object and we drop it, after that the activator "E" doesn't appears on the equip able objects. As it can be seen in the video.

https://user-images.githubusercontent.com/111510128/188225096-ccf3614e-59bc-4737-a5b6-0664cc9bea80.mp4

4-Also when we shift to the npc and try to attack with sword, it plays the animation but without sword.

https://user-images.githubusercontent.com/111510128/188225998-042b1ab9-a7d2-4167-9865-bc51a2f7cfb2.mp4

patriboz commented 2 years ago

@zenkale Issues 1 & 2: In this branch the sword still has the (old) combo as one animation (3 swings). This is the correct behavior for a single animation, it is just weird that it takes so long until the controls are enabled again. We already split this combo into 3 separate animations, similar to silsword, I will implement these animations after my current priority tasks.

Issues 3 & 4: I will work on these issues.

Thanks!

lalalune commented 2 years ago

@patriboz where we at with this?