Skip to content
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

Mocap leg fixes #9074

Merged
merged 21 commits into from Oct 17, 2023
Merged

Mocap leg fixes #9074

merged 21 commits into from Oct 17, 2023

Conversation

AidanCaruso
Copy link
Member

@AidanCaruso AidanCaruso commented Oct 17, 2023

Summary

🤖 Generated by Copilot at aeccf4c

The pull request implements various improvements and refactors for the avatar, mocap, and XR features of the engine. It enhances the accuracy, performance, and flexibility of the avatar animation, footstep, and IK systems, and supports VRM models and lower body tracking for mocap. It also simplifies and organizes the code by removing unused or unnecessary imports, variables, and actions, and by using hookstate, action queues, state mutations, and entity UUIDs. It also fixes some errors and bugs related to the XR session and the avatar thumbnail.

References

closes #insert number here

Explanation

🤖 Generated by Copilot at aeccf4c

  • Added AvatarNetworkAction.setAvatarXrTracking action to synchronize the XR tracking state of an avatar entity with the network (link, link, link, link, link)
  • Changed the condition for switching to the other foot in the setIkFootTarget function to make the footstep transition more precise and avoid jittering (link)
  • Moved the code for creating or removing the IK targets for the local avatar entity based on the XR session state and the mocap tracking scope from the AvatarIKTargetSystem to the spawnLocalAvatarInWorld and createIkTargetsForLocalAvatar functions in receiveJoinWorld.ts to avoid unnecessary loops and queries and to centralize the logic for spawning the local avatar and its IK targets (link, link, link)
  • Changed the code for solving the two bone IK for the hands and feet to use the local variables instead of the ikDataByName object and added checks for the blend weight value before calling the IK solver in the AvatarAnimationSystem (link, link)
  • Moved the code for applying the input source pose to the IK targets and setting the IK foot target from the execute function of the AvatarAnimationSystem to the if block that checks for the motionCaptureRigComponent or the XRRigComponent to avoid unnecessary calculations for non-XR or non-mocap avatars (link)
  • Changed the code for solving the hand IK to use the newScreenlandmarks instead of the landmarks for the wrist, pinky, and index positions in the solveMotionCapturePose function (link)
  • Moved the code for solving the head IK from the end of the solveMotionCapturePose function to the beginning, before the check for the newScreenlandmarks, to ensure that the head IK is always solved regardless of the hand landmarks availability (link)
  • Changed the code for solving the spine IK to use the solvingLowerBody flag and the hipRotation from the MotionCaptureRigComponent instead of the MotionCaptureState and added a fallback shoulder quaternion when the left and right hips are not visible in the solveSpine function (link, link)
  • Added the onInit, hipRotation, and solvingLowerBody properties to the MotionCaptureRigComponent definition and schema and set the solvingLowerBody flag to 1 in the useEffect hook in the component (link, link, link)
  • Added the XRRigComponent to indicate that an entity has an XR rig and enable the IK calculations for the XR avatars in the AvatarAnimationSystem (link)
  • Changed the $cache property of the AvatarNetworkAction.setAvatarAnimation action from removePrevious: true to removePrevious: false to allow multiple animation actions to be applied to the same avatar entity without removing the previous ones (link)
  • Removed the code for proxifying the rig bone positions and rotations from the MotionCaptureRigComponent and commented it out with a todo comment to indicate that it causes issues with the IK solves (link)
  • Removed the code for solving the lower leg and foot IK from the solveMotionCapturePose function and the AvatarAnimationSystem and commented it out with a todo comment to indicate that there are issues with the foot quaternions that need to be fixed (link, link)
  • Removed the code for dispatching the XRAction.sessionChanged action when the XR session ends from XRSessionFunctions.ts because it was not needed and caused errors when the session was already ended (link)
  • Removed the imports of unused modules and variables from various files to improve code readability and performance (link, link, link, link, link, link, link, link, link)
  • Replaced the repeated calls to getState(EngineState).deltaSeconds with a local variable delta in the setIkFootTarget function to improve performance (link)
  • Commented out the code for calculating the unused variables orthogonalVector and shoulderPositionAlongPlane in the solveMotionCapturePose and solveSpine functions with a todo comment to indicate that they are not used (link, link)
  • Changed the code for accessing the avatarDetails.thumbnailResource.url to use optional chaining in Header/index.tsx to avoid errors when the avatarDetails or the thumbnailResource are undefined or null (link)

🤖 Generated by Copilot at aeccf4c

AvatarAnimationSystem
Refactored for XR and mocap
Spring cleaning the code

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

@AidanCaruso AidanCaruso merged commit 1d8083e into dev Oct 17, 2023
11 of 12 checks passed
@AidanCaruso AidanCaruso deleted the mocap-leg-fixes branch October 17, 2023 17:26
@DanielBelmes
Copy link
Contributor

Belated approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants