예제 #1
0
        void Start()
        {
            ik = GetComponent <FullBodyBipedIK>();

            // You can use just LateUpdate, but note that it doesn't work when you have animatePhysics turned on for the character.
            ik.solver.OnPostUpdate += RotateShoulders;
        }
예제 #2
0
		void Start() {
			// Storing the default scale of the bomb
			defaultScale = transform.localScale;

			r = character.GetComponent<Rigidbody>();
			ik = character.GetComponent<FullBodyBipedIK>();
		}
예제 #3
0
        protected virtual void Start()
        {
            if (this.fullBody == null)
            {
                this.fullBody = base.GetComponent <FullBodyBipedIK>();
            }
            if (this.fullBody == null)
            {
                Warning.Log("InteractionSystem can not find a FullBodyBipedIK component", base.transform, false);
                return;
            }
            IKSolverFullBodyBiped expr_4B = this.fullBody.solver;

            expr_4B.OnPreUpdate = (IKSolver.UpdateDelegate)Delegate.Combine(expr_4B.OnPreUpdate, new IKSolver.UpdateDelegate(this.OnPreFBBIK));
            IKSolverFullBodyBiped expr_77 = this.fullBody.solver;

            expr_77.OnPostUpdate    = (IKSolver.UpdateDelegate)Delegate.Combine(expr_77.OnPostUpdate, new IKSolver.UpdateDelegate(this.OnPostFBBIK));
            this.OnInteractionStart = (InteractionSystem.InteractionDelegate)Delegate.Combine(this.OnInteractionStart, new InteractionSystem.InteractionDelegate(this.LookAtInteraction));
            InteractionEffector[] array = this.interactionEffectors;
            for (int i = 0; i < array.Length; i++)
            {
                InteractionEffector interactionEffector = array[i];
                interactionEffector.Initiate(this, this.fullBody.solver);
            }
            this.triggersInRange = new List <InteractionTrigger>();
            this.c = base.GetComponent <Collider>();
            this.UpdateTriggerEventBroadcasting();
            this.initiated = true;
        }
예제 #4
0
        // Initiate
        protected virtual void Start()
        {
            if (fullBody == null)
            {
                fullBody = GetComponent <FullBodyBipedIK>();
            }
            if (fullBody == null)
            {
                Warning.Log("InteractionSystem can not find a FullBodyBipedIK component", transform);
                return;
            }

            // Add to the FBBIK OnPostUpdate delegate to get a call when it has finished updating
            fullBody.solver.OnPreUpdate  += OnPreFBBIK;
            fullBody.solver.OnPostUpdate += OnPostFBBIK;
            OnInteractionStart           += LookAtInteraction;
            OnInteractionPause           += InteractionPause;
            OnInteractionResume          += InteractionResume;
            OnInteractionStop            += InteractionStop;

            foreach (InteractionEffector e in interactionEffectors)
            {
                e.Initiate(this);
            }

            triggersInRange = new List <InteractionTrigger>();

            c = GetComponent <Collider>();
            UpdateTriggerEventBroadcasting();

            initiated = true;
        }
예제 #5
0
        void Start()
        {
            ik = GetComponent<FullBodyBipedIK>();

            // You can use just LateUpdate, but note that it doesn't work when you have animatePhysics turned on for the character.
            ik.solver.OnPostUpdate += RotateShoulders;
        }
 void OnDrawGizmosSelected()
 {
     if (fullBody == null)
     {
         fullBody = GetComponent <FullBodyBipedIK>();
     }
 }
        protected override void Start()
        {
            base.Start();

            ik = GetComponent<FullBodyBipedIK>();
            animator = GetComponent<Animator>();

            lastForward = transform.forward;
        }
예제 #8
0
 IEnumerator OnInteractionEnd()
 {
     ik = apple.GetComponent<FullBodyBipedIK>();
     Debug.Log("interaction ends");
     StartCoroutine(Drop());
     while (holdWeight < 1f)
     {
         holdWeight += Time.deltaTime;
         yield return null;
     }
 }
예제 #9
0
		void Start() {
			if (!target.gameObject.activeInHierarchy)
							return;
			if (targetChildren.Length > 0)
							return;
	
	
			children = GetComponentsInChildren<Transform> ();
			targetChildren = target.GetComponentsInChildren<Transform> ();
			
			ik = target.GetComponent<FullBodyBipedIK> ();
			if (ik != null) ik.solver.OnPostUpdate += OnPostFBBIK;
		}
예제 #10
0
 private void OnDrawGizmosSelected()
 {
     if (Application.isPlaying)
     {
         return;
     }
     if (this.fullBody == null)
     {
         this.fullBody = base.GetComponent <FullBodyBipedIK>();
     }
     if (this.collider == null)
     {
         this.collider = base.GetComponent <Collider>();
     }
 }
예제 #11
0
 // Auto-assign ik
 void OnDrawGizmosSelected()
 {
     if (ik == null)
     {
         ik = GetComponent <FullBodyBipedIK>();
     }
     if (ik == null)
     {
         ik = GetComponentInParent <FullBodyBipedIK>();
     }
     if (ik == null)
     {
         ik = GetComponentInChildren <FullBodyBipedIK>();
     }
 }
예제 #12
0
	//
	private void Awake() {
		FBIK = GetComponent<FullBodyBipedIK>();
		//
		Body = FBIK.references.spine[BodySpineID];
		BIK = FBIK.solver.bodyEffector;
		LFIK = FBIK.solver.leftFootEffector;
		RFIK = FBIK.solver.rightFootEffector;
		//
		LeftFoot = FBIK.references.leftFoot;
		RightFoot = FBIK.references.rightFoot;
		//
		LeftFootContact = new RaycastHit(); RightFootContact = new RaycastHit();
		LeftToeContact = new RaycastHit(); RightToeContact = new RaycastHit();
		LegLength = Vector3.Distance(LeftFoot.position,Body.position);
	}
예제 #13
0
        // Using this to assign some default values in Editor
        void OnDrawGizmosSelected()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (fullBody == null)
            {
                fullBody = GetComponent <FullBodyBipedIK>();
            }
            if (characterCollider == null)
            {
                characterCollider = GetComponent <Collider>();
            }
        }
		protected override void Start() {
			base.Start();
			
			// Find the IK components
			aim = GetComponent<AimIK>();
			ik = GetComponent<FullBodyBipedIK>();
			
			// Disable the IK components to manage their updating
			aim.enabled = false;
			ik.enabled = false;

			// Presuming head is rotated towards character forward at Start
			headLookAxis = ik.references.head.InverseTransformVector(ik.references.root.forward);
			
			// Enable the upper-body aiming pose
			animator.SetLayerWeight(1, 1f);
		}
예제 #15
0
        // Initiate
        protected virtual void Start()
        {
            fullBody = GetComponent <FullBodyBipedIK>();

            // Add to the FBBIK OnPostUpdate delegate to get a call when it has finished updating
            fullBody.solver.OnPostUpdate += OnPostFBBIK;

            foreach (InteractionEffector e in interactionEffectors)
            {
                e.OnStart   = OnInteractionStart;
                e.OnTrigger = OnInteractionTrigger;
                e.OnRelease = OnInteractionRelease;
                e.OnPause   = OnInteractionPause;
                e.OnPickUp  = OnInteractionPickUp;
                e.OnResume  = OnInteractionResume;
                e.OnStop    = OnInteractionStop;

                e.Initiate(fullBody.solver);
            }

            initiated = true;
        }
예제 #16
0
		void Start() {
			ik = GetComponent<FullBodyBipedIK>();

			// Connect the left hand to the target
			Quaternion targetRotation = target.rotation;
			target.rotation = leftHandTarget.rotation;

			FixedJoint j = target.gameObject.AddComponent<FixedJoint>();
			j.connectedBody = leftHandTarget.GetComponent<Rigidbody>();

			target.GetComponent<Rigidbody>().MoveRotation(targetRotation);
			//target.rotation = targetRotation;

			// Remember the rotation of the root relative to the pelvis
			rootRelativeToPelvis = Quaternion.Inverse(pelvisTarget.rotation) * transform.rotation;

			// Remember the position of the root relative to the pelvis
			pelvisToRoot = Quaternion.Inverse(ik.references.pelvis.rotation) * (transform.position - ik.references.pelvis.position);

			rootTargetPosition = transform.position;
			rootTargetRotation = transform.rotation;

			lastWeight = weight;
		}
예제 #17
0
		// Initiate
		protected virtual void Start() {
			if (fullBody == null) fullBody = GetComponent<FullBodyBipedIK>();
			if (fullBody == null) {
				Warning.Log("InteractionSystem can not find a FullBodyBipedIK component", transform);
				return;
			}

			// Add to the FBBIK OnPostUpdate delegate to get a call when it has finished updating
			fullBody.solver.OnPreUpdate += OnPreFBBIK;
			fullBody.solver.OnPostUpdate += OnPostFBBIK;
			OnInteractionStart += LookAtInteraction;

			foreach (InteractionEffector e in interactionEffectors) e.Initiate(this, fullBody.solver);
	
			triggersInRange = new List<InteractionTrigger>();
			
			c = GetComponent<Collider>();
			UpdateTriggerEventBroadcasting();
			
			initiated = true;
		}
예제 #18
0
        // Initiate
        protected virtual void Start()
        {
            fullBody = GetComponent<FullBodyBipedIK>();

            // Add to the FBBIK OnPostUpdate delegate to get a call when it has finished updating
            fullBody.solver.OnPostUpdate += OnPostFBBIK;

            foreach (InteractionEffector e in interactionEffectors) {
                e.OnStart = OnInteractionStart;
                e.OnTrigger = OnInteractionTrigger;
                e.OnRelease = OnInteractionRelease;
                e.OnPause = OnInteractionPause;
                e.OnPickUp = OnInteractionPickUp;
                e.OnResume = OnInteractionResume;
                e.OnStop = OnInteractionStop;

                e.Initiate(fullBody.solver);
            }

            initiated = true;
        }
예제 #19
0
		// Auto-assign ik
		void OnDrawGizmosSelected() {
			if (ik == null) ik = GetComponent<FullBodyBipedIK>();
			if (ik == null) ik = GetComponentInParent<FullBodyBipedIK>();
			if (ik == null) ik = GetComponentInChildren<FullBodyBipedIK>();
		}
예제 #20
0
		void Start() {
			// Find some components.
			ik = GetComponent<FullBodyBipedIK>();
			poserLeftHand = ik.references.leftHand.GetComponent<Poser>();
			poserRightHand = ik.references.rightHand.GetComponent<Poser>();
			
			ik.solver.OnPostUpdate += AfterFBBIK;
			lastWeight = weight;
			
			SetHandedness(handedness);
			
			// Remember some default positions
			defaultWeaponsAnchorLocalPosition = weaponsAnchor.localPosition;
			weaponsPivotLocalPosition = weaponsPivot.localPosition;
			pivotRelativePosition = pivotMotionTarget.InverseTransformPoint(weaponsPivot.position);
			
			cameraPosition = TargetsCameraPosition();
			lastCharacterPosition = characterController.position;
		}
		protected override void Start() {
			base.Start();
			
			ik = GetComponent<FullBodyBipedIK>();
		}
		void OnDrawGizmosSelected() {
			if (fullBody == null) fullBody = GetComponent<FullBodyBipedIK>();
		}
        protected override void Start()
        {
            base.Start();

            // Find the IK components
            aim = GetComponent<AimIK>();
            ik = GetComponent<FullBodyBipedIK>();

            // Disable the IK components to manage their updating
            aim.Disable();
            ik.Disable();

            fpsCamDefaultRot = firstPersonCam.transform.localRotation;
        }
예제 #24
0
		void Start () {
			ik = GetComponent<FullBodyBipedIK> ();
	
			Sample ();
		}
예제 #25
0
		// Using this to assign some default values in Editor
		void OnDrawGizmosSelected() {
			if (Application.isPlaying) return;
			
			if (fullBody == null) fullBody = GetComponent<FullBodyBipedIK>();
			if (collider == null) collider = GetComponent<Collider>();
		}