The question is answered, right answer was accepted
VR Vive Tracker barely moving
Hi everyone,
I'm making a project with the vive tracker held in hand, and controlling the camera (it's some kind of Mixed Reality project, with no headset or controller), and it works just fine, apart from one detail.
When I move my tracker around, every movement is tracked but the scale of the movements are much too low: if I move my tracker about 50cm to the left, the object it controls moves only a tiny bit to the left. This is obviously problematic if I want to look around an object as I will not be able to actually move around it.
Is it possible to scale up the scene's coordinate system so that 1cm in real life is 10 units in unity for example? Is this is possible, is it the right approach to my problem?
Answer by Maygar · Dec 04, 2018 at 10:26 AM
I found a solution to my problem so if anyone is having the same issue, here's what I did:
I created a cube GameObject that I called TrackingSpace, scaled it up so it would fit the whole scene and deactivated the mesh renderer (the mesh is only used to see the size in the scene view). Than I dragged my Tracker GameObject to be a child of the TrackingSpace, and everything works fine, now I can scale the TrackingSpace to fit the coordinate system that I want. Be careful however if you want to change the scale at runtime to change the movement sensitivity, as this would make the Tracker jump to another location. I got around this problem by moving the TrackingSpace once it was scaled down/up like this (add this script to the Tracker GameObject):
public float changeFactor;
public Transform trackingSpace;
void Update () {
if (Input.GetKeyDown(KeyCode.Plus)) {
ChangeScale(dampingFactor);
}
if (Input.GetKeyDown(KeyCode.Minus)) {
ChangeScale( / dampingFactor);
}
void ChangeScale (float factor) {
Vector initPos = transform.position;
trackingSpace.localScale *= factor;
Vector newPos = transform.position;
Vector deltaPos = newPos - initPos;
trackingSpace.position -= deltaPos;
}