Hello. I’m currently trying to use Vive Trackers to drive the bones with Basic IK set up for legs and hands. The movement and IK work pretty well but my only problem is with the axis discrepancy between the trackers and the bones.
The main issue with Vive Trackers is that the trackers rotation depends on the room scale calibration, specifically when you aim towards the screen to set the “forward” of the room scale.
When creating my mocap plugin using Vive Trackers, the first thing I did was to reorient the Vive Trackers using a scene component that is the “father” of all trackers, to make sure that both the real life user and the trackers are using the same forward orientation.
From there you have different options:
Break the rotators and use them similar to what you already done
In Control Rig use a rotation constraint ( with offset ) between the current vive tracker rotation and the foot current rotation, so that whatever rotation the vive tracker has, as soon as you apply the rotation constraint ( with offset ) the foot rotation will follow accordingly.
The problem is that the axes are completely wrong. Say, I perform a pitch (Y) with my controller, then the foot of my avatar rotates on the real Z axis. That makes sense because the Y axis is the actual yaw axis of the foot bone. If I swap the axes, so that it’s “correct”, it still doesn’t work and the orientation of my foot gets all messed up. This also happens with the Vive Motion Controllers, so not just the trackers.
Could you give a visual example of this?
Are we talking an opposite axis value (up instead of down, or left instead of right) or something completely different?
It’s likely the axis needs more than just swizzling.
You have Z “up” by swizzling Y to Z.
What could be needed here is to simply *-1 the Z transform before feeding into Y. Mostly a guess, mind you.
I recall vive trackers to be left handed, so the way you have it should work Ok…
But…
The character’s bone (left or right) have inverted axis.
Left foot should be Y forward, Z Left, X Down.
The right one is mirrored to X Up, Y back.
Doesn’t help, but anatomically:
The X axis on these should never rotate at all (unless you have a broken foot or some rather anomalous cartilage setup).
Z is the one you rotate to pitch up/down within reason (90deg max?)
While Y usually rotates around 5deg to 10deg maybe 15 for some circus freaks - and generally only towards the interior, as if you roll the other way past a few deg you break your ankle…
You also have to assume your initial vive calibration doesn’t match the original bone rotation, so the value probably can’t be used in a 1:1 solution, and that may be the actual issue of the positon instead of axis flipping…
Pictures, or better, footage of it in action would help figure out what the situation is.
The tracker will be attached to the foot in the same orientation I have held it in my hand, so the foot of my mesh shouldn’t look like.
Now, if I rotate the foot using a Modify Bone node to have it in the correct orientation, the rotations get broken. I don’t know whether I should tweak the input by just swizzling and inverting or whether there’s some sort of setting/calibration that I overlooked.
To make things even more difficult, here’s what the orientation of the foot bone looks like:
Well yes - there are calibration settings.
Otherwise every rotation would have to be configured to match only that object, which is improbable since no one would develop for just one product…
Also, without it, it would require you to always align the tracker in a specific way, which isnt always possible.
Thats all outside of the engine anyway.
Swizzling the axis to adjust from left hand to right hand coordinate system probably has to be done in Engine - but its probably supposed to happen automatically up the chain?
Having only used the tracker to track x/y/z position I do not recall having had to fuss with any axis at all.
So it probably goes back onto the confoguration of it, but its also a “standard”. Meaning all vive trackers have the same coordinate system, the stuff for unreal should already be well aware and correct for it without even giving an option? (But its Epic so who know?)
Past the actual axis debacle, what Enter_Reality suggested is probably the best way to handle this:
At that point if the rotations you see in engine are not matched correctly… first test both feet.
Again, the bone axis on those are different, which can be the real root of the problem.
If both feet react the same, then the problem is the axis that the input comes in with. Try checking on the initial configuration for it.
If the feet react different, then the issue is the translation of the rotations to the bone space.
Perhaps you can do just that, transform the rotation from world space to bone space… that way you don’t need to sort the axis yourself (though its helpful to know whats what?).
In addition to what MostHost_LA mentioned, you need to take into account that the tracker position on your feet won’t match the center of rotation of the ankle, so you’ll end up having a weird rotation behaviour because of that.
What you can do is to add a scene component as a child of the Motion Controller component, and apply and offset on it, so that it would roughly match the same position as the ankle on your character.
Thank you very much for your help, guys. I ended up using only the translation of the trackers as input for the Control Rig and then the rotation of the trackers to modify the bones directly for pure rotation. Seems the way to go, as IK only works with the location of the effectors. From there, it only needs some swizzling and math to get the axes right. Pretty easy!