jokke Posted November 10, 2022 Share Posted November 10, 2022 I want to set the roles for all trackers in code. VivePoseTracker class has property viveRole but it is getter only. How can I achieve something like below? VivePoseTracker poseTracker = go.GetComponent<VivePoseTracker>(); poseTracker.viveRole = ViveRoleProperty.New(TrackerRole.Tracker1); Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted November 10, 2022 Share Posted November 10, 2022 Hi @jokke, Could you check this out to see if this is ok for your case? Link to comment Share on other sites More sharing options...
jokke Posted November 11, 2022 Author Share Posted November 11, 2022 (edited) Hi @chengnay, Thanks but that is not what I'm looking for. I've working setup where I bind the physical trackers to different tracker roles (1-3). What I need is that when my app starts, it creates one game object per tracker from prefab. In that prefab there's VivePoseTracker component which has it's vive role set to Tracker1 by default but I need to dynamically change that into Tracker2, Tracker3 for the others. So looking for solution to modify viverole property in code in VivePoseTracker class. Edited November 11, 2022 by jokke Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted November 13, 2022 Share Posted November 13, 2022 Hi @jokke, I will check with my colleague whether it is possible to modify ViveRole property. Could you add the prefabs to the scene and set active to false? When you need it, enable them by using script. Link to comment Share on other sites More sharing options...
jokke Posted November 14, 2022 Author Share Posted November 14, 2022 Hi @chengnay, That prefab method could work as an intermediate solutions but I'm eager to find a cleaner way. This custom solution might be expanded to 16 trackers and the prefab way can get really bad to maintain. Great if you can check how the role setting could be done in code. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted November 14, 2022 Share Posted November 14, 2022 Hi @jokke, After checking with my Colleague, he said you can do the following method, VivePoseTracker poseTracker = go.GetComponent<VivePoseTracker>();poseTracker.viveRole.SetEx<TrackerRole>(TrackerRole.Tracker1); Hope this helps, feel free to ask questions if you have any. Link to comment Share on other sites More sharing options...
jokke Posted November 14, 2022 Author Share Posted November 14, 2022 8 minutes ago, chengnay said: Hi @jokke, After checking with my Colleague, he said you can do the following method, VivePoseTracker poseTracker = go.GetComponent<VivePoseTracker>();poseTracker.viveRole.SetEx<TrackerRole>(TrackerRole.Tracker1); Hope this helps, feel free to ask questions if you have any. Thanks, this is what I was looking for, now it works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now