GetEffector() public méthode

Gets the effector of type.
public GetEffector ( FullBodyBipedEffector effector ) : RootMotion.FinalIK.IKEffector
effector FullBodyBipedEffector
Résultat RootMotion.FinalIK.IKEffector
            public Transform target; // The target

            #endregion Fields

            #region Methods

            // Update IK position, rotation and weight
            public void Update(IKSolverFullBodyBiped solver, float weight)
            {
                solver.GetEffector(effector).position = target.position;
                solver.GetEffector(effector).rotation = target.rotation;

                solver.GetEffector(effector).positionWeight = positionWeight * weight;
                solver.GetEffector(effector).rotationWeight = rotationWeight * weight;
            }
Exemple #2
0
            public void Apply(IKSolverFullBodyBiped solver, float weight, Quaternion rotation)
            {
                solver.GetEffector(this.effector).positionOffset += rotation * this.offset * weight;
                Vector3 a       = solver.GetRoot().position + rotation * this.pin;
                Vector3 vector  = a - solver.GetEffector(this.effector).bone.position;
                Vector3 vector2 = this.pinWeight * Mathf.Abs(weight);

                solver.GetEffector(this.effector).positionOffset = new Vector3(Mathf.Lerp(solver.GetEffector(this.effector).positionOffset.x, vector.x, vector2.x), Mathf.Lerp(solver.GetEffector(this.effector).positionOffset.y, vector.y, vector2.y), Mathf.Lerp(solver.GetEffector(this.effector).positionOffset.z, vector.z, vector2.z));
            }
Exemple #3
0
            // Update this body, apply the offset to the effector
            public void Update(IKSolverFullBodyBiped solver, float weight, float deltaTime)
            {
                if (transform == null)
                {
                    return;
                }

                // If first update, set this body to Transform
                if (firstUpdate)
                {
                    Reset();
                    firstUpdate = false;
                }

                // Acceleration
                direction = Vector3.Lerp(direction, ((transform.position - lazyPoint) / deltaTime) * 0.01f, deltaTime * acceleration);

                // Lazy follow
                lazyPoint += direction * deltaTime * speed;

                // Match velocity
                delta      = transform.position - lastPosition;
                lazyPoint += delta * matchVelocity;

                // Gravity
                lazyPoint.y += gravity * deltaTime;

                // Apply position offset to the effector
                foreach (EffectorLink effectorLink in effectorLinks)
                {
                    solver.GetEffector(effectorLink.effector).positionOffset += (lazyPoint - transform.position) * effectorLink.weight * weight;
                }

                lastPosition = transform.position;
            }
Exemple #4
0
			// Update the Body
			public void Update(IKSolverFullBodyBiped solver, float w, float deltaTime) {
				if (transform == null || relativeTo == null) return;

				// Find the relative position of the transform
				Vector3 relativePos = relativeTo.InverseTransformDirection(transform.position - relativeTo.position);

				// Initiating
				if (firstUpdate) {
					lastRelativePos = relativePos;
					firstUpdate = false;
				}

				// Find how much the relative position has changed
				Vector3 delta = (relativePos - lastRelativePos) / deltaTime;

				// Smooth the change
				smoothDelta = speed <= 0f? delta: Vector3.Lerp(smoothDelta, delta, deltaTime * speed);

				// Convert to world space
				Vector3 worldDelta = relativeTo.TransformDirection(smoothDelta);

				// Extract horizontal and vertical offset
				Vector3 offset = V3Tools.ExtractVertical(worldDelta, solver.GetRoot().up, verticalWeight) + V3Tools.ExtractHorizontal(worldDelta, solver.GetRoot().up, horizontalWeight);

				// Apply the amplitude to the effector links
				for (int i = 0; i < effectorLinks.Length; i++) {
					solver.GetEffector(effectorLinks[i].effector).positionOffset += offset * w * effectorLinks[i].weight;
				}

				lastRelativePos = relativePos;
			}
Exemple #5
0
            public void Update(IKSolverFullBodyBiped solver, float w, float deltaTime)
            {
                if (this.transform == null || this.relativeTo == null)
                {
                    return;
                }
                Vector3 a = this.relativeTo.InverseTransformDirection(this.transform.position - this.relativeTo.position);

                if (this.firstUpdate)
                {
                    this.lastRelativePos = a;
                    this.firstUpdate     = false;
                }
                Vector3 vector = (a - this.lastRelativePos) / deltaTime;

                this.smoothDelta = ((this.speed > 0f) ? Vector3.Lerp(this.smoothDelta, vector, deltaTime * this.speed) : vector);
                Vector3 v  = this.relativeTo.TransformDirection(this.smoothDelta);
                Vector3 a2 = V3Tools.ExtractVertical(v, solver.GetRoot().up, this.verticalWeight) + V3Tools.ExtractHorizontal(v, solver.GetRoot().up, this.horizontalWeight);

                for (int i = 0; i < this.effectorLinks.Length; i++)
                {
                    solver.GetEffector(this.effectorLinks[i].effector).positionOffset += a2 * w * this.effectorLinks[i].weight;
                }
                this.lastRelativePos = a;
            }
 // Apply offset to FBBIK effectors
 public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight)
 {
     foreach (EffectorLink e in effectorLinks)
     {
         solver.GetEffector(e.effector).positionOffset += rotation * (offset * masterWeight * e.weight);
     }
 }
Exemple #7
0
			// Update this body, apply the offset to the effector
			public void Update(IKSolverFullBodyBiped solver, float weight, float deltaTime) {
				if (transform == null) return;

				// If first update, set this body to Transform
				if (firstUpdate) {
					Reset();
					firstUpdate = false;
				}

				// Acceleration
				direction = Vector3.Lerp(direction, ((transform.position - lazyPoint) / deltaTime) * 0.01f, deltaTime * acceleration);

				// Lazy follow
				lazyPoint += direction * deltaTime * speed;

				// Match velocity
				delta = transform.position - lastPosition;
				lazyPoint += delta * matchVelocity;
				
				// Gravity
				lazyPoint.y += gravity * deltaTime;

				// Apply position offset to the effector
				foreach (EffectorLink effectorLink in effectorLinks) {
					solver.GetEffector(effectorLink.effector).positionOffset += (lazyPoint - transform.position) * effectorLink.weight * weight;
				}

				lastPosition = transform.position;
			}
Exemple #8
0
			// Apply offset to FBBIK effectors
			public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight, float length, float timeLeft) {
				additiveOffset = Vector3.Lerp(Vector3.zero, additiveOffset, timeLeft / length);
				lastOffset = (rotation * (offset * masterWeight)) + (rotation * additiveOffset);

				foreach (EffectorLink e in effectorLinks) {
					solver.GetEffector(e.effector).positionOffset += lastOffset * e.weight;
				}
			}
        // Apply the curve to the specified solver, effector, with the value and weight.
        private void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, WeightCurve.Type type, float value, float weight)
        {
            switch (type)
            {
            case WeightCurve.Type.PositionWeight:
                solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
                return;

            case WeightCurve.Type.RotationWeight:
                solver.GetEffector(effector).rotationWeight = Mathf.Lerp(solver.GetEffector(effector).rotationWeight, value, weight);
                return;

            case WeightCurve.Type.PositionOffsetX:
                solver.GetEffector(effector).position += solver.GetRoot().rotation *Vector3.right *value *weight;
                return;

            case WeightCurve.Type.PositionOffsetY:
                solver.GetEffector(effector).position += solver.GetRoot().rotation *Vector3.up *value *weight;
                return;

            case WeightCurve.Type.PositionOffsetZ:
                solver.GetEffector(effector).position += solver.GetRoot().rotation *Vector3.forward *value *weight;
                return;

            case WeightCurve.Type.Pull:
                solver.GetChain(effector).pull = Mathf.Lerp(solver.GetChain(effector).pull, value, weight);
                return;

            case WeightCurve.Type.Reach:
                solver.GetChain(effector).reach = Mathf.Lerp(solver.GetChain(effector).reach, value, weight);
                return;
            }
        }
Exemple #10
0
 public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight, float length, float timeLeft)
 {
     this.additiveOffset = Vector3.Lerp(Vector3.zero, this.additiveOffset, timeLeft / length);
     this.lastOffset     = rotation * (this.offset * masterWeight) + rotation * this.additiveOffset;
     foreach (Recoil.RecoilOffset.EffectorLink effectorLink in this.effectorLinks)
     {
         solver.GetEffector(effectorLink.effector).positionOffset += this.lastOffset * effectorLink.weight;
     }
 }
Exemple #11
0
            // Apply offset to FBBIK effectors
            public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight, float length, float timeLeft)
            {
                additiveOffset = Vector3.Lerp(Vector3.zero, additiveOffset, timeLeft / length);
                lastOffset     = (rotation * (offset * masterWeight)) + (rotation * additiveOffset);

                foreach (EffectorLink e in effectorLinks)
                {
                    solver.GetEffector(e.effector).positionOffset += lastOffset * e.weight;
                }
            }
Exemple #12
0
        // Initiate this, get the default values
        public void Initiate(IKSolverFullBodyBiped solver)
        {
            // Find the effector if we haven't already
            if (effector == null)
            {
                effector = solver.GetEffector(effectorType);
                poser    = effector.bone.GetComponent <Poser>();
            }

            defaultPull  = solver.GetChain(effectorType).pull;
            defaultReach = solver.GetChain(effectorType).reach;
        }
 public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver)
 {
     this.interactionSystem = interactionSystem;
     if (this.effector == null)
     {
         this.effector = solver.GetEffector(this.effectorType);
         this.poser    = this.effector.bone.GetComponent <Poser>();
     }
     this.defaultPull       = solver.GetChain(this.effectorType).pull;
     this.defaultReach      = solver.GetChain(this.effectorType).reach;
     this.defaultPush       = solver.GetChain(this.effectorType).push;
     this.defaultPushParent = solver.GetChain(this.effectorType).pushParent;
 }
		// Initiate this, get the default values
		public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver) {
			this.interactionSystem = interactionSystem;

			// Find the effector if we haven't already
			if (effector == null) {
				effector = solver.GetEffector(effectorType);
				poser = effector.bone.GetComponent<Poser>();
			}

			defaultPull = solver.GetChain(effectorType).pull;
			defaultReach = solver.GetChain(effectorType).reach;
			defaultPush = solver.GetChain(effectorType).push;
			defaultPushParent = solver.GetChain(effectorType).pushParent;
		}
        // Apply the curve to the specified solver, effector, with the value and weight.
        private void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, WeightCurve.Type type, float value, float weight)
        {
            switch (type)
            {
            case WeightCurve.Type.PositionWeight:
                solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
                return;

            case WeightCurve.Type.RotationWeight:
                solver.GetEffector(effector).rotationWeight = Mathf.Lerp(solver.GetEffector(effector).rotationWeight, value, weight);
                return;

            case WeightCurve.Type.PositionOffsetX:
                Vector3 xOffset = (positionOffsetSpace != null ? positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.right * value;
                solver.GetEffector(effector).position += xOffset * weight;
                //solver.GetEffector(effector).positionOffset += xOffset;
                return;

            case WeightCurve.Type.PositionOffsetY:
                Vector3 yOffset = (positionOffsetSpace != null ? positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.up * value;
                solver.GetEffector(effector).position += yOffset * weight;
                //solver.GetEffector(effector).positionOffset += yOffset;
                return;

            case WeightCurve.Type.PositionOffsetZ:
                Vector3 zOffset = (positionOffsetSpace != null ? positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.forward * value;
                solver.GetEffector(effector).position += zOffset * weight;
                //solver.GetEffector(effector).positionOffset += zOffset;
                return;

            case WeightCurve.Type.Pull:
                solver.GetChain(effector).pull = Mathf.Lerp(solver.GetChain(effector).pull, value, weight);
                return;

            case WeightCurve.Type.Reach:
                solver.GetChain(effector).reach = Mathf.Lerp(solver.GetChain(effector).reach, value, weight);
                return;

            case WeightCurve.Type.Push:
                solver.GetChain(effector).push = Mathf.Lerp(solver.GetChain(effector).push, value, weight);
                return;

            case WeightCurve.Type.PushParent:
                solver.GetChain(effector).pushParent = Mathf.Lerp(solver.GetChain(effector).pushParent, value, weight);
                return;

            case WeightCurve.Type.BendGoalWeight:
                solver.GetChain(effector).bendConstraint.weight = Mathf.Lerp(solver.GetChain(effector).bendConstraint.weight, value, weight);
                return;
            }
        }
Exemple #16
0
        // Initiate this, get the default values
        public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver)
        {
            this.interactionSystem = interactionSystem;

            // Find the effector if we haven't already
            if (effector == null)
            {
                effector = solver.GetEffector(effectorType);
                poser    = effector.bone.GetComponent <Poser>();
            }

            defaultPull       = solver.GetChain(effectorType).pull;
            defaultReach      = solver.GetChain(effectorType).reach;
            defaultPush       = solver.GetChain(effectorType).push;
            defaultPushParent = solver.GetChain(effectorType).pushParent;
        }
Exemple #17
0
            public void Solve(IKSolverFullBodyBiped solver, float weight)
            {
                // Get the offset to interpolate to
                offsetTarget = GetOffsetTarget(solver);

                // Interpolating the offset value
                float smoothDampTime = offsetTarget.sqrMagnitude > offset.sqrMagnitude? smoothTimeIn: smoothTimeOut;

                offset = Vector3.SmoothDamp(offset, offsetTarget, ref offsetV, smoothDampTime);

                // Apply offset to the FBBIK effectors
                foreach (EffectorLink link in effectors)
                {
                    solver.GetEffector(link.effector).positionOffset += offset * weight * link.weight;
                }
            }
Exemple #18
0
        private void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionObject.WeightCurve.Type type, float value, float weight)
        {
            switch (type)
            {
            case InteractionObject.WeightCurve.Type.PositionWeight:
                solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
                return;

            case InteractionObject.WeightCurve.Type.RotationWeight:
                solver.GetEffector(effector).rotationWeight = Mathf.Lerp(solver.GetEffector(effector).rotationWeight, value, weight);
                return;

            case InteractionObject.WeightCurve.Type.PositionOffsetX:
                solver.GetEffector(effector).position += ((this.positionOffsetSpace != null) ? this.positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.right * value * weight;
                return;

            case InteractionObject.WeightCurve.Type.PositionOffsetY:
                solver.GetEffector(effector).position += ((this.positionOffsetSpace != null) ? this.positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.up * value * weight;
                return;

            case InteractionObject.WeightCurve.Type.PositionOffsetZ:
                solver.GetEffector(effector).position += ((this.positionOffsetSpace != null) ? this.positionOffsetSpace.rotation : solver.GetRoot().rotation) * Vector3.forward * value * weight;
                return;

            case InteractionObject.WeightCurve.Type.Pull:
                solver.GetChain(effector).pull = Mathf.Lerp(solver.GetChain(effector).pull, value, weight);
                return;

            case InteractionObject.WeightCurve.Type.Reach:
                solver.GetChain(effector).reach = Mathf.Lerp(solver.GetChain(effector).reach, value, weight);
                return;

            case InteractionObject.WeightCurve.Type.RotateBoneWeight:
                return;

            case InteractionObject.WeightCurve.Type.Push:
                solver.GetChain(effector).push = Mathf.Lerp(solver.GetChain(effector).push, value, weight);
                return;

            case InteractionObject.WeightCurve.Type.PushParent:
                solver.GetChain(effector).pushParent = Mathf.Lerp(solver.GetChain(effector).pushParent, value, weight);
                return;

            default:
                return;
            }
        }
Exemple #19
0
 public void Update(IKSolverFullBodyBiped solver, float weight, float deltaTime)
 {
     if (this.transform == null)
     {
         return;
     }
     if (this.firstUpdate)
     {
         this.Reset();
         this.firstUpdate = false;
     }
     this.direction   = Vector3.Lerp(this.direction, (this.transform.position - this.lazyPoint) / deltaTime * 0.01f, deltaTime * this.acceleration);
     this.lazyPoint  += this.direction * deltaTime * this.speed;
     this.delta       = this.transform.position - this.lastPosition;
     this.lazyPoint  += this.delta * this.matchVelocity;
     this.lazyPoint.y = this.lazyPoint.y + this.gravity * deltaTime;
     foreach (Inertia.Body.EffectorLink effectorLink in this.effectorLinks)
     {
         solver.GetEffector(effectorLink.effector).positionOffset += (this.lazyPoint - this.transform.position) * effectorLink.weight * weight;
     }
     this.lastPosition = this.transform.position;
 }
			public Vector3 pinWeight; // Pin weight vector

			// Apply positionOffset to the effector
			public void Apply(IKSolverFullBodyBiped solver, float weight, Quaternion rotation) {
				// Offset
				solver.GetEffector(effector).positionOffset += rotation * offset * weight;
				
				// Calculating pinned position
				Vector3 pinPosition = solver.GetRoot().position + rotation * pin;
				Vector3 pinPositionOffset = pinPosition - solver.GetEffector(effector).bone.position;
				
				Vector3 pinWeightVector = pinWeight * Mathf.Abs(weight);
				
				// Lerping to pinned position
				solver.GetEffector(effector).positionOffset = new Vector3(
					Mathf.Lerp(solver.GetEffector(effector).positionOffset.x, pinPositionOffset.x, pinWeightVector.x),
					Mathf.Lerp(solver.GetEffector(effector).positionOffset.y, pinPositionOffset.y, pinWeightVector.y),
					Mathf.Lerp(solver.GetEffector(effector).positionOffset.z, pinPositionOffset.z, pinWeightVector.z)
					);
			}
            // Update the Body
            public void Update(IKSolverFullBodyBiped solver, float w, float deltaTime)
            {
                if (transform == null || relativeTo == null)
                {
                    return;
                }

                // Find the relative position of the transform
                Vector3 relativePos = relativeTo.InverseTransformDirection(transform.position - relativeTo.position);

                // Initiating
                if (firstUpdate)
                {
                    lastRelativePos = relativePos;
                    firstUpdate     = false;
                }

                // Find how much the relative position has changed
                Vector3 delta = (relativePos - lastRelativePos) / deltaTime;

                // Smooth the change
                smoothDelta = speed <= 0f? delta: Vector3.Lerp(smoothDelta, delta, deltaTime * speed);

                // Convert to world space
                Vector3 worldDelta = relativeTo.TransformDirection(smoothDelta);

                // Extract horizontal and vertical offset
                Vector3 offset = V3Tools.ExtractVertical(worldDelta, solver.GetRoot().up, verticalWeight) + V3Tools.ExtractHorizontal(worldDelta, solver.GetRoot().up, horizontalWeight);

                // Apply the amplitude to the effector links
                for (int i = 0; i < effectorLinks.Length; i++)
                {
                    solver.GetEffector(effectorLinks[i].effector).positionOffset += offset * w * effectorLinks[i].weight;
                }

                lastRelativePos = relativePos;
            }
            public Vector3 pinWeight;              // Pin weight vector

            // Apply positionOffset to the effector
            public void Apply(IKSolverFullBodyBiped solver, float weight, Quaternion rotation)
            {
                // Offset
                solver.GetEffector(effector).positionOffset += rotation * offset * weight;

                // Calculating pinned position
                Vector3 pinPosition       = solver.GetRoot().position + rotation * pin;
                Vector3 pinPositionOffset = pinPosition - solver.GetEffector(effector).bone.position;

                Vector3 pinWeightVector = pinWeight * Mathf.Abs(weight);

                // Lerping to pinned position
                solver.GetEffector(effector).positionOffset = new Vector3(
                    Mathf.Lerp(solver.GetEffector(effector).positionOffset.x, pinPositionOffset.x, pinWeightVector.x),
                    Mathf.Lerp(solver.GetEffector(effector).positionOffset.y, pinPositionOffset.y, pinWeightVector.y),
                    Mathf.Lerp(solver.GetEffector(effector).positionOffset.z, pinPositionOffset.z, pinWeightVector.z)
                    );
            }
        // Initiate this, get the default values
        public void Initiate(IKSolverFullBodyBiped solver)
        {
            // Find the effector if we haven't already
            if (effector == null) {
                effector = solver.GetEffector(effectorType);
                poser = effector.bone.GetComponent<Poser>();
            }

            defaultPull = solver.GetChain(effectorType).pull;
            defaultReach = solver.GetChain(effectorType).reach;
        }
                // Apply an offset to this effector
                public void Apply(IKSolverFullBodyBiped solver, Vector3 offset, float crossFader)
                {
                    current = Vector3.Lerp(lastValue, offset * weight, crossFader);

                    solver.GetEffector(effector).positionOffset += current;
                }
Exemple #25
0
 public void Apply(IKSolverFullBodyBiped solver, Vector3 offset, float crossFader)
 {
     this.current = Vector3.Lerp(this.lastValue, offset * this.weight, crossFader);
     solver.GetEffector(this.effector).positionOffset += this.current;
 }
Exemple #26
0
            // Update this body, apply the offset to the effector
            public void Update(IKSolverFullBodyBiped solver, float weight)
            {
                // If first update, set this body to Transform
                if (firstUpdate) {
                    Reset();
                    firstUpdate = false;
                }

                // not using Time.deltaTime or Time.fixedDeltaTime here, because we don't know if animatePhysics is true or not on the character, so we have to keep track of time ourselves.
                float deltaTime = Time.time - lastTime;

                // Acceleration
                direction = Vector3.Lerp(direction, transform.position - lazyPoint, deltaTime * acceleration);

                // Lazy follow
                lazyPoint += direction * deltaTime * speed;

                // Match velocity
                delta = transform.position - lastPosition;
                lazyPoint += delta * matchVelocity;

                // Gravity
                lazyPoint.y += gravity * deltaTime;

                // Apply position offset to the effector
                foreach (EffectorLink effectorLink in effectorLinks) {
                    solver.GetEffector(effectorLink.effector).positionOffset += (lazyPoint - transform.position) * effectorLink.weight * weight;
                }

                lastPosition = transform.position;
                lastTime = Time.time;
            }
Exemple #27
0
                // Update and Apply the position offset to the effector
                public void Update(IKSolverFullBodyBiped solver, Vector3 offsetTarget, float weight)
                {
                    // Lerping offset to the offset target
                    offset = Vector3.Lerp(offset, offsetTarget * multiplier, Time.deltaTime * speed);

                    // Apply gravity
                    Vector3 g = (solver.GetRoot().up * gravity) * offset.magnitude;

                    // Apply the offset to the effector
                    solver.GetEffector(effector).positionOffset += (offset * weight * this.weight) + (g * weight);
                }
Exemple #28
0
 // Apply offset to FBBIK effectors
 public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight)
 {
     foreach (EffectorLink e in effectorLinks) {
         solver.GetEffector(e.effector).positionOffset += rotation * (offset * masterWeight * e.weight);
     }
 }
		// Apply the curve to the specified solver, effector, with the value and weight.
		private void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, WeightCurve.Type type, float value, float weight) {
			switch(type) {
			case WeightCurve.Type.PositionWeight:
				solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
				return;
			case WeightCurve.Type.RotationWeight:
				solver.GetEffector(effector).rotationWeight = Mathf.Lerp(solver.GetEffector(effector).rotationWeight, value, weight);
				return;
			case WeightCurve.Type.PositionOffsetX:
				solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.right * value * weight;
				return;
			case WeightCurve.Type.PositionOffsetY:
				solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.up * value * weight;
				return;
			case WeightCurve.Type.PositionOffsetZ:
				solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.forward * value * weight;
				return;
			case WeightCurve.Type.Pull:
				solver.GetChain(effector).pull = Mathf.Lerp(solver.GetChain(effector).pull, value, weight);
				return;
			case WeightCurve.Type.Reach:
				solver.GetChain(effector).reach = Mathf.Lerp(solver.GetChain(effector).reach, value, weight);
				return;
			case WeightCurve.Type.Push:
				solver.GetChain(effector).push = Mathf.Lerp(solver.GetChain(effector).push, value, weight);
				return;
			case WeightCurve.Type.PushParent:
				solver.GetChain(effector).pushParent = Mathf.Lerp(solver.GetChain(effector).pushParent, value, weight);
				return;
			}
		}
Exemple #30
0
			// Set effector position and rotation weight to match the value, multiply with the weight of this Absorber
			public void SetEffectorWeights(IKSolverFullBodyBiped solver, float w) {
				solver.GetEffector(effector).positionWeight = w * weight;
				solver.GetEffector(effector).rotationWeight = w * weight;
			}
Exemple #31
0
			// Set effector position and rotation to match it's bone
			public void SetToBone(IKSolverFullBodyBiped solver) {
				// Using world space position and rotation here for the sake of simplicity of the demo
				// Ideally we should use position and rotation relative to character's root, so we could move around while doing this.
				solver.GetEffector(effector).position = solver.GetEffector(effector).bone.position;
				solver.GetEffector(effector).rotation = solver.GetEffector(effector).bone.rotation;
			}