Meta Avatars: how to feed custom input?
Hi,
I'm prototyping with the new Meta Avatars system and am using the SampleAvatarEntity script to instantiate fake avatars. I'd like to replay head pose, controller states, and/or hand states (positions) in order to drive these avatars from pre-recorded data in my scene.
Using SampleInputManager (included with the avatar examples) as a starting point, I assumed all I had to do was provide my own InputTrackingDelegate, InputControlDelegate, and (for hand tracking), HandTrackingDelegate. I started with this, feeding in fake controller inputs and marking the controllers as active but it has absolutely no effect. The avatar spawns in t-pose and does nothing.
public class ReplayAvatarInputManager : OvrAvatarInputManager
{
protected void Awake()
{
}
private void Start()
{
if (BodyTracking != null)
{
BodyTracking.InputTrackingDelegate = new ReplayInputTrackingDelegate();
BodyTracking.InputControlDelegate = new SampleInputControlDelegate();
}
}
protected override void OnDestroyCalled()
{
base.OnDestroyCalled();
}
}
public class ReplayInputTrackingDelegate : OvrAvatarInputTrackingDelegate
{
public ReplayInputTrackingDelegate()
{
}
public override bool GetRawInputTrackingState(out OvrAvatarInputTrackingState inputTrackingState)
{
inputTrackingState = new OvrAvatarInputTrackingState();
inputTrackingState.headsetActive = true;
inputTrackingState.leftControllerActive = true;
inputTrackingState.rightControllerActive = true;
inputTrackingState.leftControllerVisible = true;
inputTrackingState.rightControllerVisible = true;
inputTrackingState.headset.position = Vector3.zero;
inputTrackingState.headset.orientation = Quaternion.identity;
inputTrackingState.headset.scale = Vector3.one;
inputTrackingState.leftController.position = 2*Vector3.one;
inputTrackingState.rightController.position = Vector3.one;
inputTrackingState.leftController.orientation = Quaternion.identity;
inputTrackingState.rightController.orientation = Quaternion.identity;
inputTrackingState.leftController.scale = Vector3.one;
inputTrackingState.rightController.scale = Vector3.one;
return true;
}
}
The delegate method is called, I've confirmed, but the data it returns is not being used. What am I doing wrong? I've made sure to connect this ReplayAvatarInputManager behavior to the Tracking Input property on SampleAvatarEntity.
Thanks,
Bart
