Example #1
0
	public override void UpdateController () {
		if (this.enabled) {
			tracking = true;

			if (leftFootAnimation == null) 
				leftFootAnimation = ivr.leftFootTarget.GetComponent<IVR_Animate>();
			if (rightFootAnimation == null)
				rightFootAnimation = ivr.rightFootTarget.GetComponent<IVR_Animate>();

			if (selected)
				FeetAnimation();
		} else
			tracking = false;
	}
Example #2
0
    public override void StartController(InstantVR ivr)
    {
        base.StartController(ivr);

        if (this.transform == ivr.leftFootTarget) {
            isLeftFoot = true;
            leftFoot = this;
            rightFoot = ivr.rightFootTarget.GetComponent<IVR_AnimatorFoot>();
            leftFootAnimation = this.gameObject.AddComponent<IVR_Animate>();
        } else {
            rightFoot = this;
            leftFoot = ivr.leftFootTarget.GetComponent<IVR_AnimatorFoot>();
            rightFootAnimation = this.gameObject.AddComponent<IVR_Animate>();
        }

        startHipFootL = ivr.hipTarget.InverseTransformPoint(ivr.leftFootTarget.position);//ivr.leftFootTarget.position - ivr.hipTarget.position;
        startHipFootR = ivr.hipTarget.InverseTransformPoint(ivr.rightFootTarget.position);//ivr.rightFootTarget.position - ivr.hipTarget.position;

        startFootLposition = ivr.leftFootTarget.position - ivr.BasePosition;
        startFootRposition = ivr.rightFootTarget.position - ivr.BasePosition;
    }
Example #3
0
    private void FootStepping(IVR_Animate footAnimation, Vector3 startHipFoot)
    {
        if (footAnimation.f >= 1) {
            footAnimation.startStep = false;
            footAnimation.f = 0;
        } else if (footAnimation.f > 0) {
            Vector3 stepTarget = ivr.hipTarget.TransformPoint(startHipFoot) - stepStart;
            stepTarget = new Vector3(stepTarget.x, startPosition.y, stepTarget.z);

            if (curSpeed.x != 0 || curSpeed.z != 0) {
                Vector3 avgSpeed2 = basePointDelta / footAnimation.f;
                stepTarget += avgSpeed2 / 2;
            }

            Vector3 newPosition = footAnimation.AnimationLerp(Vector3.zero, stepTarget, ref footAnimation.f);
            transform.position = stepStart + newPosition;
            transform.rotation = ivr.hipTarget.rotation; // should be eased towards this rotation in the end
        }
    }
Example #4
0
    protected void FootStepRight(IVR_Animate footAnimation, Vector3 hipTargetPosition, Vector3 footTargetPosition, bool follow)
    {
        if (footAnimation.startStep == false) {
            basePointStart = ivr.BasePosition;
            stepStart = new Vector3(footTargetPosition.x, ivr.BasePosition.y, footTargetPosition.z);
            footAnimation.startStep = true;

            if (!follow)
                rightFoot.lastStepRight = true;
            leftFoot.lastStepLeft = false;
        }
    }