public override void OnNewPoses() { var deviceIndex = viveRole.GetDeviceIndex(); // set targetPose to device pose targetPose = VivePose.GetPose(deviceIndex) * new RigidPose(posOffset, Quaternion.Euler(rotOffset)); ModifyPose(ref targetPose, origin); // transform to world space var o = origin != null ? origin : transform.parent; if (o != null) { targetPose = new RigidPose(o) * targetPose; targetPose.pos.Scale(o.localScale); } if (m_snap) { m_snap = false; transform.position = targetPose.pos; transform.rotation = targetPose.rot; } SetIsValid(VivePose.IsValid(deviceIndex)); }
public virtual void OnNewPoses() { TrackPose(VivePose.GetPose(role), origin); var isValidCurrent = VivePose.IsValid(role); if (isValid != isValidCurrent) { isValid = isValidCurrent; onIsValidChanged.Invoke(isValid); } }
public virtual void OnNewPoses() { var deviceIndex = m_viveRole.GetDeviceIndex(); var isValid = VivePose.IsValid(deviceIndex); if (isValid) { TrackPose(VivePose.GetPose(deviceIndex), origin); } SetIsValid(isValid); }
public virtual void OnNewPoses() { var deviceIndex = m_viveRole.GetDeviceIndex(); var isValid = VivePose.IsValid(deviceIndex); if (isValid) { var pose = VivePose.GetPose(deviceIndex); if (m_origin != null && m_origin != transform.parent) { pose = new RigidPose(m_origin.transform) * pose; TrackPose(pose, false); } else { TrackPose(pose, true); } } SetIsValid(isValid); }
public override void OnNewPoses() { targetPose = VivePose.GetPose(role) * new Pose(posOffset, Quaternion.Euler(rotOffset)); ModifyPose(ref targetPose, origin); // transform to world space var o = origin != null ? origin : transform.parent; if (o != null) { targetPose = new Pose(o) * targetPose; targetPose.pos.Scale(o.localScale); } var poseValid = VivePose.IsValid(role); if (!isPoseValid && poseValid) { transform.position = targetPose.pos; transform.rotation = targetPose.rot; } SetIsValid(poseValid); }
protected virtual void Start() { SetIsValid(VivePose.IsValid(m_viveRole), true); }
public virtual void OnNewPoses() { TrackPose(VivePose.GetPose(role), origin); SetIsValid(VivePose.IsValid(role)); }
protected virtual void Start() { isValid = VivePose.IsValid(role); onIsValidChanged.Invoke(isValid); }
//Update 함수가 호출되기 전에 한 번만 호출, 다른 스크립트의 Awake가 모두 실행 된 후 실행 protected virtual void Start() { //Role(right hand, left hand)를 Valid로 변경 SetIsValid(VivePose.IsValid(m_viveRole), true); }