Jump to content

Setting tracker role in code?


jokke

Recommended Posts

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

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 by jokke
Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...