Skip to content

Fix/example#45

Merged
tattn merged 4 commits intotattn:mainfrom
tatsuya-ogawa:fix/example
Mar 18, 2026
Merged

Fix/example#45
tattn merged 4 commits intotattn:mainfrom
tatsuya-ogawa:fix/example

Conversation

@tatsuya-ogawa
Copy link
Copy Markdown
Contributor

@tatsuya-ogawa tatsuya-ogawa commented Mar 18, 2026

#44

  • In the example app, I updated the shoulder rotation pivot because using the upper arm produced a more natural look than using the shoulder.
    For VRM 1.0, however, the shoulder pivot already looked more natural, so no changes were made.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines how arm rotations are applied to VRM models within the example applications. It introduces a version-aware mechanism to correctly target either shoulder or upper arm nodes based on whether the VRM model is v0 or v1. This change resolves potential issues with incorrect pose application and improves the robustness of the examples when handling different VRM standards.

Highlights

  • VRM Version-Specific Arm Node Selection: Implemented logic to correctly identify and select arm nodes (shoulder or upper arm) based on the VRM model's version (v0 or v1) across various example applications.
  • Improved Pose Application Accuracy: Ensured that arm rotations are applied to the appropriate humanoid bones, enhancing the accuracy of pose adjustments for different VRM model versions.
  • Documentation Update: Updated the README.md to reflect the new, version-aware approach for applying arm rotations in code examples.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue with selecting the appropriate arm bones for different VRM versions across the example applications. While the fix is effective, it introduces a significant amount of duplicated code. My review focuses on suggesting refactoring opportunities to abstract this logic, which will improve code clarity and maintainability in both the application code and the README documentation.

Comment on lines +103 to +112
let leftArm: Entity?
let rightArm: Entity?
switch vrmEntity.vrm {
case .v1:
leftArm = vrmEntity.humanoid.node(for: .leftShoulder)
rightArm = vrmEntity.humanoid.node(for: .rightShoulder)
case .v0:
leftArm = vrmEntity.humanoid.node(for: .leftUpperArm)
rightArm = vrmEntity.humanoid.node(for: .rightUpperArm)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic for determining the arm entities based on the VRM version is duplicated across multiple example files (RealityKitViewController.swift, MacExample/ContentView.swift, VisionExample/ContentView.swift). A similar duplication exists for SCNNode in ViewController.swift and WatchExample Watch App/ViewModel.swift.

To improve code reuse and maintainability, consider abstracting this logic into computed properties on VRMEntity and VRMNode respectively.

For example, you could add this to VRMEntity:

public var leftArm: Entity? {
    switch vrm {
    case .v1: return humanoid.node(for: .leftShoulder)
    case .v0: return humanoid.node(for: .leftUpperArm)
    }
}

public var rightArm: Entity? {
    switch vrm {
    case .v1: return humanoid.node(for: .rightShoulder)
    case .v0: return humanoid.node(for: .rightUpperArm)
    }
}

This would make the call sites much cleaner.

If you prefer to keep the changes local to this file for now, you can make the existing code more concise by initializing leftArm and rightArm as a tuple.

            let (leftArm, rightArm): (Entity?, Entity?)
            switch vrmEntity.vrm {
            case .v1:
                (leftArm, rightArm) = (vrmEntity.humanoid.node(for: .leftShoulder), vrmEntity.humanoid.node(for: .rightShoulder))
            case .v0:
                (leftArm, rightArm) = (vrmEntity.humanoid.node(for: .leftUpperArm), vrmEntity.humanoid.node(for: .rightUpperArm))
            }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, the logic is intended for visual adjustments specific to each example, so I think keeping it local rather than abstracting it is preferable.

tatsuya-ogawa and others added 2 commits March 18, 2026 20:44
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@tattn tattn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the example! It looks good to me, so I’ll merge it!

@tattn tattn merged commit b427699 into tattn:main Mar 18, 2026
5 checks passed
@tatsuya-ogawa tatsuya-ogawa deleted the fix/example branch March 18, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants