Skip to content

Add the XRController sample. #5

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

Merged
merged 12 commits into from
Mar 7, 2025
Merged

Conversation

hj-cpdm-son
Copy link
Contributor

  • This sample includes XRController assets (prefab, animation, scripts, etc.).
  • If you use this sample, import it with the URP project.
  • It will be updated when new Controller assets are released.

@salarkhan-google
Copy link
Collaborator

salarkhan-google commented Feb 20, 2025

Everything seems fine. Except that shader graph should not really be used since then the package would need to depend on it, and the shader should work on both URP and built in rendering pipeline. Also I noticed for the left eye the controllers render fine but for the right eye they seem to be offset. Please check the screenshot. The two spheres were attached to the controller prefab for reference, so it indicates that the transform is still in the appropriate place but the mesh is not rendering as expected for the right eye.
screenshot

@salarkhan-google
Copy link
Collaborator

Update: I used Unity standard material and then it rendered correctly for right eye. Please fix any shader issues that might be causing offset rendering for right eye or you can just a Unity standard shader and create a new material and assign the textures to it.
screenshot

@hj-cpdm-son
Copy link
Contributor Author

Hello
I updated the controller shader. As you mentioned, the asset does not use Shader Graph;
If a user is working with a non-URP project, they can simply switch the shader to Standard.

@salarkhan-google
Copy link
Collaborator

Please make default shader built-in RP Standard since this package itself does not depend on URP. If user imports this project into URP project, they would know that they need to convert shaders. Other samples in this package also use the built-in RP Standard Material.

Please use solid Color for camera clear flags and set the background color to (0, 0, 0, 0) to ensure it uses passthrough.

Other than this it looks good to go.

@salarkhan-google
Copy link
Collaborator

Sorry one final change. I noticed the controller was way too down. This is because your camera y offset is not 0 which sets the session camera origin a little higher, and therefore the controllers local position positions being set in XRRig are more down relative to the Camera Origin. To fix this, please make the controllers child objects of Camera Offset. This way the controller trackers share the same origin as the camera.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add apache license header to source file. You can check examples of our other source files. Please ensure to use your organization name.

@LevanaChen
Copy link
Collaborator

Hi,
Thanks for the contribution. One more minor change here. Could you remove the redundant "Controller" folder so all types of assets folders are directly under the sample root?

Copy link
Collaborator

@salarkhan-google salarkhan-google left a comment

Choose a reason for hiding this comment

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

Could you remove the redundant "Controller" folder and bring all its content under "XRController" folder so all types of assets folders are directly under the sample root?

@@ -0,0 +1,228 @@
// <copyright file="XRControllerDisplay.cs" company="Samsung Electronics Co.">
//
// Copyright 2025 Samsung Electronics Co.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry forgot to mention this, I just recently found out. The Contribution License Agreement (CLA) requires that new files added to a Google-maintained open source project should include a license header with a "Google LLC" copyright notice, whether the file is created by a Googler or Non-Googler.

From a legal perspective, leaving "Copyright Google LLC" in the headers does not affect the contributors' rights.

Therefore, please change company name to Google LLC.

@salarkhan-google salarkhan-google merged commit 6c28167 into android:main Mar 7, 2025
1 check passed
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.

3 participants