public void Update() { if (Time.frameCount != preFrame) { preFrame = Time.frameCount; preControllerStates = controllerStates; if (NoloVR_Playform.GetInstance().GetPlayformError() == NoloError.None && NoloVR_Playform.GetInstance().GetAuthentication()) { controllerStates = NoloVR_Plugins.GetControllerStates(index); if (isTurnAround) { if (NoloVR_Controller.recPosition == Vector3.zero) { NoloVR_Controller.recPosition = NoloVR_Plugins.GetPose(0).pos; } pose = NoloVR_Plugins.GetPose(index); var rot = pose.rot.eulerAngles; rot += new Vector3(0, 180, 0); pose.rot = Quaternion.Euler(rot); pose.pos.x = NoloVR_Controller.recPosition.x * 2 - pose.pos.x; pose.pos.z = NoloVR_Controller.recPosition.z * 2 - pose.pos.z; pose.vecVelocity.x = -pose.vecVelocity.x; pose.vecVelocity.z = -pose.vecVelocity.z; return; } NoloVR_Controller.recPosition = Vector3.zero; pose = NoloVR_Plugins.GetPose(index); } } }
public void Update() { if (Time.frameCount != preFrame) { preFrame = Time.frameCount; preControllerStates = controllerStates; if (NoloVR_Playform.InitPlayform().GetPlayformError() == NoloError.None) { controllerStates = NoloVR_Plugins.GetControllerStates(index); trackingStatus = NoloVR_Plugins.GetTrackingStatus(index); if (isTurnAround) { if (NoloVR_Controller.recPosition == Vector3.zero) { NoloVR_Controller.recPosition = NoloVR_Plugins.GetPose(0).pos; } pose = NoloVR_Plugins.GetPose(index); //pose.rot *= new Quaternion(0, 1, 0, 0); Vector3 rot = pose.rot.eulerAngles; rot += new Vector3(0, 180, 0); pose.rot = Quaternion.Euler(rot); pose.pos.x = NoloVR_Controller.recPosition.x * 2 - pose.pos.x; pose.pos.z = NoloVR_Controller.recPosition.z * 2 - pose.pos.z; return; } NoloVR_Controller.recPosition = Vector3.zero; pose = NoloVR_Plugins.GetPose(index); } } }
public void Update() { if (Time.frameCount != preFrame) { preFrame = Time.frameCount; preControllerStates = controllerStates; if (NoloVR_Playform.GetInstance().GetPlayformError() == NoloError.None && NoloVR_Playform.GetInstance().GetAuthentication()) { controllerStates = NoloVR_Plugins.GetControllerStates(index); electricity = NoloVR_Plugins.GetElectricity(index); connectStatus = NoloVR_Plugins.GetNoloConnectStatus(index); float yaw = real_yaw * 57.3f; pose = NoloVR_Plugins.GetPose(index); if (index == 0) { //pose.pos += pose.rot * new Vector3(0, 0.08f, 0.062f); pose.rot = Quaternion.Euler(new Vector3(0, -yaw, 0)); //pose.pos -= pose.rot * new Vector3(0, 0.08f, 0.062f); } if (isTurnAround) { if (NoloVR_Controller.recPosition == Vector3.zero) { NoloVR_Controller.recPosition = NoloVR_Plugins.GetPose(0).pos; } var rot = pose.rot.eulerAngles; rot += new Vector3(0, 180 + yaw, 0); pose.rot = Quaternion.Euler(rot); Vector3 revec = Quaternion.Euler(new Vector3(0, 180 + yaw, 0)) * pose.pos + NoloVR_Controller.recPosition; pose.pos.x = revec.x; pose.pos.z = revec.z; pose.vecVelocity.x = -pose.vecVelocity.x; pose.vecVelocity.z = -pose.vecVelocity.z; return; } } if (NoloVR_System.GetInstance().realTrackDevices != 3 && NoloVR_System.GetInstance().realTrackDevices != 6) { NoloVR_System.GetInstance().realTrackDevices = NoloVR_Plugins.GetTrackModel(); } } }