void Update() { if (Driver == null) { return; } Pose p; //Get the current pose from the driver if (!Driver.GetPose(out p)) { return; } if (RecordPackets) { RecordPose(Time.deltaTime, p); //If we're recording, record the pose } UpdateTransform(HeadRoot, p.headPosition, p.headRotation); //Update the various avatar components with this pose UpdateTransform(HandLeftRoot, p.handLeftPosition, p.handLeftRotation); UpdateTransform(HandRightRoot, p.handRightPosition, p.handRightRotation); ControllerLeft?.UpdatePose(p.controllerLeftPose); ControllerRight?.UpdatePose(p.controllerRightPose); HandLeft?.UpdatePose(p.handLeftPose); HandRight?.UpdatePose(p.handRightPose); Head?.UpdatePose(p.voiceAmplitude); TempFixupTransforms(); }
// Update is called once per frame void Update() { if (Driver != null) { // Get the current pose from the driver OvrAvatarDriver.PoseFrame pose; if (Driver.GetCurrentPose(out pose)) { // If we're recording, record the pose if (RecordPackets) { RecordFrame(Time.deltaTime, pose); } // Update the various avatar components with this pose UpdateTransform(HeadRoot, pose.headPosition, pose.headRotation); UpdateTransform(HandLeftRoot, pose.handLeftPosition, pose.handLeftRotation); UpdateTransform(HandRightRoot, pose.handRightPosition, pose.handRightRotation); if (ControllerLeft != null) { ControllerLeft.UpdatePose(pose.controllerLeftPose); } if (ControllerRight != null) { ControllerRight.UpdatePose(pose.controllerRightPose); } if (HandLeft != null) { HandLeft.UpdatePose(pose.handLeftPose); } if (HandRight != null) { HandRight.UpdatePose(pose.handRightPose); } if (Head != null) { Head.UpdatePose(pose.voiceAmplitude); } TempFixupTransforms(); } } }
// Update is called once per frame void Update() { if (Driver != null) { // Get the current pose from the driver OvrAvatarDriver.PoseFrame pose; if (Driver.GetCurrentPose(out pose)) { // If we're recording, record the pose if (RecordPackets) { RecordFrame(Time.deltaTime, pose); } // Update the various avatar components with this pose if (ControllerLeft != null) { ControllerLeft.UpdatePose(pose.controllerLeftPose); } if (ControllerRight != null) { ControllerRight.UpdatePose(pose.controllerRightPose); } if (HandLeft != null) { HandLeft.UpdatePose(pose.controllerLeftPose); } if (HandRight != null) { HandRight.UpdatePose(pose.controllerRightPose); } if (Body != null) { Body.UpdatePose(pose.voiceAmplitude); } if (sdkAvatar != IntPtr.Zero) { ovrAvatarTransform bodyTransform = CreateOvrAvatarTransform(pose.headPosition, pose.headRotation); ovrAvatarHandInputState inputStateLeft = CreateInputState(CreateOvrAvatarTransform(pose.handLeftPosition, pose.handLeftRotation), pose.controllerLeftPose); ovrAvatarHandInputState inputStateRight = CreateInputState(CreateOvrAvatarTransform(pose.handRightPosition, pose.handRightRotation), pose.controllerRightPose); foreach (float[] voiceUpdate in voiceUpdates) { Oculus.Avatar.CAPI.ovrAvatarPose_UpdateVoiceVisualization(sdkAvatar, voiceUpdate); } voiceUpdates.Clear(); Oculus.Avatar.CAPI.ovrAvatarPose_UpdateBody(sdkAvatar, bodyTransform); Oculus.Avatar.CAPI.ovrAvatarPose_UpdateHands(sdkAvatar, inputStateLeft, inputStateRight); Oculus.Avatar.CAPI.ovrAvatarPose_Finalize(sdkAvatar, Time.deltaTime); } } } if (sdkAvatar != IntPtr.Zero && assetLoadingIds.Count == 0) { //If all of the assets for this avatar have been loaded, update the avatar UpdateSDKAvatarUnityState(); UpdateCustomPoses(); if (!assetsFinishedLoading) { AssetsDoneLoading.Invoke(); assetsFinishedLoading = true; } } }
// Update is called once per frame void Update() { if (Driver != null) { // Get the current pose from the driver OvrAvatarDriver.PoseFrame pose; if (Driver.GetCurrentPose(out pose)) { // If we're recording, record the pose if (RecordPackets) { RecordFrame(Time.deltaTime, pose); } // Update the various avatar components with this pose if (ControllerLeft != null) { ControllerLeft.UpdatePose(pose.controllerLeftPose); } if (ControllerRight != null) { ControllerRight.UpdatePose(pose.controllerRightPose); } if (HandLeft != null) { HandLeft.UpdatePose(pose.controllerLeftPose); } if (HandRight != null) { HandRight.UpdatePose(pose.controllerRightPose); } if (Body != null) { Body.UpdatePose(pose.voiceAmplitude); } if (sdkAvatar != IntPtr.Zero) { ovrAvatarTransform bodyTransform = CreateOvrAvatarTransform(pose.headPosition, pose.headRotation); ovrAvatarHandInputState inputStateLeft = CreateInputState(CreateOvrAvatarTransform(pose.handLeftPosition, pose.handLeftRotation), pose.controllerLeftPose); ovrAvatarHandInputState inputStateRight = CreateInputState(CreateOvrAvatarTransform(pose.handRightPosition, pose.handRightRotation), pose.controllerRightPose); foreach (float[] voiceUpdate in voiceUpdates) { CAPI.ovrAvatarPose_UpdateVoiceVisualization(sdkAvatar, voiceUpdate); } voiceUpdates.Clear(); CAPI.ovrAvatarPose_UpdateBody(sdkAvatar, bodyTransform); CAPI.ovrAvatarPose_UpdateHands(sdkAvatar, inputStateLeft, inputStateRight); CAPI.ovrAvatarPose_Finalize(sdkAvatar, Time.deltaTime); } } } if (sdkAvatar != IntPtr.Zero && assetLoadingIds.Count == 0) { //If all of the assets for this avatar have been loaded, update the avatar UpdateSDKAvatarUnityState(); UpdateCustomPoses(); if (!assetsFinishedLoading) { AssetsDoneLoading.Invoke(); assetsFinishedLoading = true; } } /* * if(leftHandCollider) * { * if ((OVRInput.Get(OVRInput.RawAxis1D.LIndexTrigger) > triggerGrabDeadzone || OVRInput.Get(OVRInput.RawAxis1D.LHandTrigger) > triggerGrabDeadzone) && !leftGrabbingObject) * { * //leftHandCollider.enabled = true; * leftHandCollider.isTrigger = false; * } * else * { * leftHandCollider.isTrigger = true; * //leftHandCollider.enabled = false; * } * } * if (rightHandCollider) * { * if ((OVRInput.Get(OVRInput.RawAxis1D.RIndexTrigger) > triggerGrabDeadzone || OVRInput.Get(OVRInput.RawAxis1D.RHandTrigger) > triggerGrabDeadzone) && !rightGrabbingObject) * { * rightHandCollider.isTrigger = false; * //rightHandCollider.enabled = true; * * } * else * { * rightHandCollider.isTrigger = true; * //rightHandCollider.enabled = false; * } * } */ }