コード例 #1
0
    public override void StartController(InstantVR ivr)
    {
        base.StartController(ivr);
        present = true;

        rightInput = ivr.rightHandTarget.GetComponent<IVR_Input>();
    }
コード例 #2
0
ファイル: InstantVR.cs プロジェクト: ys27/wearhacks2016
	protected virtual void Awake() {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        extensions = this.GetComponents<IVR_Extension>();
		foreach (IVR_Extension extension in extensions)
			extension.StartExtension();

		headControllers = headTarget.GetComponents<IVR_Controller>();
		leftHandControllers = leftHandTarget.GetComponents<IVR_Controller>();
		rightHandControllers = rightHandTarget.GetComponents<IVR_Controller>();
		hipControllers = hipTarget.GetComponents<IVR_Controller>();
		leftFootControllers = leftFootTarget.GetComponents<IVR_Controller>();
		rightFootControllers = rightFootTarget.GetComponents<IVR_Controller>();

		headController = FindActiveController(headControllers);
		leftHandController = FindActiveController(leftHandControllers);
		rightHandController = FindActiveController(rightHandControllers);
		hipController = FindActiveController(hipControllers);
		leftFootController = FindActiveController(leftFootControllers);
		rightFootController = FindActiveController(rightFootControllers);
        
		leftInput = leftHandTarget.GetComponent<IVR_Input>();
		rightInput = rightHandTarget.GetComponent<IVR_Input>();

        leftMovements = leftHandTarget.GetComponent<IVR_Movements>();
		rightMovements = rightHandTarget.GetComponent<IVR_Movements>();

		Animator[] animators = GetComponentsInChildren<Animator>();
		for (int i = 0; i < animators.Length; i++) {
			Avatar avatar = animators[i].avatar;
			if (avatar.isValid && avatar.isHuman) {
				characterTransform = animators[i].transform;
				
				AddRigidbody(characterTransform.gameObject);
			}
		}
		
		foreach (IVR_Controller c in headControllers)
			c.StartController(this);
		foreach (IVR_Controller c in leftHandControllers)
			c.StartController(this);
		foreach (IVR_Controller c in rightHandControllers)
			c.StartController(this);
		foreach (IVR_Controller c in hipControllers)
			c.StartController(this);
		foreach (IVR_Controller c in leftFootControllers)
			c.StartController(this);
		foreach (IVR_Controller c in rightFootControllers)
			c.StartController(this);

		IVR_BodyMovements bm = GetComponent<IVR_BodyMovements>();
		if (bm != null)
			bm.StartMovements();

		if (leftMovements != null && leftMovements.enabled)
			leftMovements.StartMovements(this);
		if (rightMovements != null && rightMovements.enabled)
			rightMovements.StartMovements(this);
	}
コード例 #3
0
    public override void StartController(InstantVR ivr)
    {
        base.StartController(ivr);
        present = true;

        joystick2present = CheckJoystick2Present();
        ivrInput = this.gameObject.GetComponent<IVR_Input>();

        hipStartRotationY = ivr.hipTarget.eulerAngles.y;
    }
コード例 #4
0
	public override void StartController(InstantVR ivr) {
		base.StartController(ivr);
		present = true;

		ivrInput = GetComponent<IVR_Input>();
        handMovements = GetComponent<IVR_HandMovementsBase>();

        joystick2available = CheckJoystick2Present();
        bumpersAvailable = CheckBumpersAvailable();
        triggersAvailable = CheckTriggersAvailable();
        startBackAvailable = CheckStartBackAvailable();

        hipStartRotationY = ivr.hipTarget.eulerAngles.y;
	}
コード例 #5
0
ファイル: IVR_Walking.cs プロジェクト: ys27/wearhacks2016
    void Start() {
        ivr = this.GetComponent<InstantVR>();

        leftInput = ivr.leftHandTarget.GetComponent<IVR_Input>();
        bodyCapsule = AddHipCollider(ivr.hipTarget.gameObject);
    }
コード例 #6
0
ファイル: InstantVR.cs プロジェクト: paulchorba/TrueVR
    protected virtual void Awake()
    {
        RaycastHit hit;
        Vector3 rayStart = hipTarget.position;
        if (Physics.Raycast(rayStart, Vector3.down, out hit, 2f, ~myBodyLayer))
            basePosition = new Vector3(hipTarget.position.x, hit.point.y, hipTarget.position.z);
        else
            basePosition = new Vector3(hipTarget.position.x, 0, hipTarget.position.z);
        baseRotation = this.transform.rotation;

        extensions = this.GetComponents<IVR_Extension>();
        foreach (IVR_Extension extension in extensions)
            extension.StartExtension();

        headControllers = headTarget.GetComponents<IVR_Controller>();
        leftHandControllers = leftHandTarget.GetComponents<IVR_Controller>();
        rightHandControllers = rightHandTarget.GetComponents<IVR_Controller>();
        hipControllers = hipTarget.GetComponents<IVR_Controller>();
        leftFootControllers = leftFootTarget.GetComponents<IVR_Controller>();
        rightFootControllers = rightFootTarget.GetComponents<IVR_Controller>();

        headController = FindActiveController(headControllers);
        leftHandController = FindActiveController(leftHandControllers);
        rightHandController = FindActiveController(rightHandControllers);
        hipController = FindActiveController(hipControllers);
        leftFootController = FindActiveController(leftFootControllers);
        rightFootController = FindActiveController(rightFootControllers);

        leftInput = leftHandTarget.GetComponent<IVR_Input>();
        if (leftInput)
            leftInput.StartInput(this);
        rightInput = rightHandTarget.GetComponent<IVR_Input>();
        if (rightInput)
            rightInput.StartInput(this);

        leftMovements = leftHandTarget.GetComponent<IVR_Movements>();
        rightMovements = rightHandTarget.GetComponent<IVR_Movements>();

        SetIVRLayer();

        Animator[] animators = GetComponentsInChildren<Animator>();
        for (int i = 0; i < animators.Length; i++) {
            Avatar avatar = animators[i].avatar;
            if (avatar.isValid && avatar.isHuman) {
                characterTransform = animators[i].transform;

                AddRigidbody(characterTransform.gameObject);
            }
        }

        foreach (IVR_Controller c in headControllers)
            c.StartController(this);
        foreach (IVR_Controller c in leftHandControllers)
            c.StartController(this);
        foreach (IVR_Controller c in rightHandControllers)
            c.StartController(this);
        foreach (IVR_Controller c in hipControllers)
            c.StartController(this);
        foreach (IVR_Controller c in leftFootControllers)
            c.StartController(this);
        foreach (IVR_Controller c in rightFootControllers)
            c.StartController(this);

        BodyMovementsBasics bm = GetComponent<BodyMovementsBasics>();
        if (bm != null)
            bm.StartMovements();

        if (leftMovements != null)
            leftMovements.StartMovements(this);
        if (rightMovements != null)
            rightMovements.StartMovements(this);
    }