Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Giantbean · Nov 27, 2019 at 12:48 AM · vrsteam

Change menu graphic material based on which controller type is being used in Steam VR.

I have an in game/vr computer screen showing the controller settings in my project. I have different graphics to put on this screen based on when the user is running the game with a Valve Index controller or a Vive (pro) Controller. Each graphic is set with its own material which I can swap but what I need to know is how the build recognizes which controller is being used?

SteamVR and Unity OpenVR must have a way of telling which controller is in use as it automatically swaps out the model of the controller but I don't know how to tap into that recognition so I can swap my graphic.

I have been looking at SteamVR_RenderModel.cs (mostly around line 145-167.) but I can't seem to figure it out and I don't even know if I'm looking in the right place? (https://github.com/ValveSoftware/steamvr_unity_plugin)

Do any of you know how to do this?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Giantbean · Nov 27, 2019 at 04:11 PM 0
Share

I have found the IVR system but the documentation is confusing? Can any one help me understand how I would change out player instructions based on what controller is in use? It seems like this would be a common need but I have not found any information clarifying the concept while scouring the web for a solution.

https://github.com/ValveSoftware/openvr/wiki/IVRSystem::GetTrackedDeviceProperty https://github.com/ValveSoftware/openvr/wiki/API-Documentation https://github.com/ValveSoftware/openvr/wiki/IVRSystem::GetTrackedDeviceClass

avatar image Giantbean Giantbean · Nov 27, 2019 at 06:43 PM 0
Share

This is as far as I have made it. Its not much.

 using UnityEngine;
 using Valve.VR;
 
 public class ControllerBasedRenderer : $$anonymous$$onoBehaviour
 {
     public Renderer Object;
     public $$anonymous$$aterial default$$anonymous$$aterial;
     public $$anonymous$$aterial vive$$anonymous$$aterial;
     public $$anonymous$$aterial index$$anonymous$$aterial;
     public $$anonymous$$aterial oculus$$anonymous$$aterial;
 
     void OnEnable()
     {
         //Subscribe to the event that is called by S$$anonymous$$mVR_Render$$anonymous$$odel, when the controller and it's associated material has been loaded completely.
         S$$anonymous$$mVR_Events.Render$$anonymous$$odelLoaded.Listen(OnControllerLoaded);
     }
 
 
     void Start() //$$anonymous$$eep the script accessible to turn off/on in the inspector.
     {
        
     }
 
     public void Update$$anonymous$$aterial($$anonymous$$aterial new$$anonymous$$aterial)
     {
 
         //How can I find if Vive or if index/knuckles?
         //if(controler index is the vive?){
         Object.material = vive$$anonymous$$aterial;
 
         //if its an index controller in use?
         //Object.material = index$$anonymous$$aterial;
 
         //if its an oculas touch?
         //Object.material = oculus$$anonymous$$aterial;
 }
 
     void OnControllerLoaded(S$$anonymous$$mVR_Render$$anonymous$$odel controllerRender$$anonymous$$odel, bool success)
     {
         Update$$anonymous$$aterial(default$$anonymous$$aterial);
     }
 
     void OnDisable()
     {
         //Unsubscribe to the event if this object is disabled.
         S$$anonymous$$mVR_Events.Render$$anonymous$$odelLoaded.Remove(OnControllerLoaded);
     }
 
 }

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

147 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Haptics/Vibrations only with OpenVr 1 Answer

SteamVR 1.2.0 - only first two connected controllers give button input 0 Answers

Interaction with UI using SteamVR 0 Answers

[Solved] SteamVR - Replacing the Vive controller texture/model IN Unity? 1 Answer

First Person Player controller for Steam VR 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges