-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App: avatar aiming IK #1611
Comments
Note that using an Wooblyverse.-.Google.Chrome.2021-10-21.13-03-47.mp4 |
Incorrect blend implementation of the pitch/yaw for reference: #1612 |
Testing the IK solution: #1616 |
Heads up that I merged a functional version of this via #1616 It doesn't look great yet and needs kickback, IK accuracy fixes, and better effects, but it's a starting point. |
I added pistol kickback with #1624 |
Overview
We need avatars to aim guns/phones/etc properly when you right click to aim.
Right now there is not much of an aiming implementation (it just rotates the avatar). However there are two existing solutions with might be used.
We need a solution that meets these requirements, as well as looks good. The gun pose should be dynamic, like fortnite or a cool anime.
Requirements
First, we will bind weapons to the wrist (like gun), and we will raycast from the gun to shoot, so the wrist must be very accurate, pointing in the direction of the camera (where the user is pointing). It cannot be glitchy.
Secondly, it should look natural at all angles in the range -PI/2 <-> PI/2, around the hips direction. Why hips direction? Because the hips move independently and can be PI/2 max out of sync with the shooting animation. This is already implemented in the codebase/proposed IK solution.
Therefore, third, this solution to this needs to play nice with the lower body animations, since we aren't replacing the entire animation system right now.
Finally, whatever solution we use should be performant (e.g. not adding more allocations in the frame loop, adding GC pressure, etc.).
Possible solutions
Two approaches were already tested:
However, there are better solutions with more work -- like for example custom procedural IK for this special case, or a different keyframe mix.
Code points
app/avatars/avatars.js
Line 1997 in cf93527
app/avatars/avatars.js
Line 1985 in cf93527
app/avatars/avatars.js
Line 2003 in cf93527
animations.cbor
):app/avatars/avatars.js
Line 146 in cf93527
animations.cbor
is baked usingnode ./animations-baker.mjs public/animations/*.fbx public/animations/animations.cbor
Nice to have/future work
Related issues
#1607
The text was updated successfully, but these errors were encountered: