Conversation
Summary of ChangesHello, 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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| 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) | ||
| } |
There was a problem hiding this comment.
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))
}There was a problem hiding this comment.
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.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
tattn
left a comment
There was a problem hiding this comment.
Thanks for improving the example! It looks good to me, so I’ll merge it!
#44
For VRM 1.0, however, the shoulder pivot already looked more natural, so no changes were made.