public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { leftLegAnimation leftLeg = parent as leftLegAnimation; if (type.Contains(AnimationType.walking)) { if (leftLeg != null) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) * (leftLeg.swingTime + (inverted ? -1 : 1) * 1), 0), .2f); } } else if (type.Contains(AnimationType.running)) { if (leftLeg != null) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) * (leftLeg.swingTime + (inverted ? -1 : 1) * 2), 0), .2f); } } else if (type.Contains(AnimationType.standing)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f); } lerpRotation(); }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { TorsoAnimation torso = parent as TorsoAnimation; if (torso != null) { swingTime = torso.swingTime; } if (type.Contains(AnimationType.running)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0) , .400000f); } else if (type.Contains(AnimationType.walking)) { //rotation = Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0); currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? 1 : -1) * walkArmSwingAmount * (swingTime), 0) , .1200000f); } else if (type.Contains(AnimationType.standing)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0) , .1200000f); } lerpRotation(); }
public void orderAnimation(List <AnimationType> type, AnimationSystem parent) { animationSystem.handleOrder(type, parent); foreach (BodyPart child in children) { child.orderAnimation(type, animationSystem); } }
public void setAnimations() { animationSystem = AnimationSystemFactory.getSystemFromType(type); foreach (BodyPart child in children) { child.setAnimations(); } }
public BodyPart(PaintedCubeSpace nModel, Vector3 nLoc, BodyPartType nType, string nFileName) { model = nModel; model.loc = nLoc; children = new List <BodyPart>(); animationSystem = new noAnimation(); type = nType; fileName = nFileName; rotationOffset = Quaternion.Identity; }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { age++; //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age*5)); if (type.Contains(AnimationType.torsoLeftShoulderForward)) { //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 5)); currentTarget = new MovementTarget(leftShoulderForward, .02f); //swingTimeInter.floatingCameraSpeed = .1f; } else if (type.Contains(AnimationType.walking)) { //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 5)); periodInter.idealValue = 5; magInter.idealValue = 1; swingTimeInter.idealValue = (float)Math.Sin(MathHelper.ToRadians((float)age * 7)) * 1; currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0), 2f); //swingTimeInter.floatingCameraSpeed = .1f; } else if (type.Contains(AnimationType.running)) { //swingTime = (float)Math.Sin(MathHelper.ToRadians((float)age * 12)) * 2; //periodInter.idealValue = 10; magInter.idealValue = 3; swingTimeInter.idealValue = (float)Math.Sin(MathHelper.ToRadians((float)age * 10)) * 2; //rotation = Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0); currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(getYaw(), 0, 0), .2f); //swingTimeInter.floatingCameraSpeed = .5f; } else { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f); } swingTimeInter.update(); periodInter.update(); magInter.update(); swingTime = swingTimeInter.value; lerpRotation(); //currentAnimation = taskType; //rotation = Quaternion.Slerp(rotation, currentTarget.goal, currentTarget.floatingCameraSpeed / AnimationFunctions.angleBetweenQuaternions(rotation, currentTarget.goal)); }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { if (type.Contains(AnimationType.running) || type.Contains(AnimationType.walking)) { turn += 5; rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(-turn)); } else if (type.Contains(AnimationType.standing)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((0 ), 0, MathHelper.ToRadians(1)), .2f); } //lerpRotation(); }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { leftArmAnimation parentArm = parent as leftArmAnimation; if (type.Contains(AnimationType.armsOut)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .2f); } else if (type.Contains(AnimationType.stabLeftArm) && !inverted) { currentTarget = new MovementTarget(extended, .6f); } else if (type.Contains(AnimationType.stabRightArm) && inverted) { currentTarget = new MovementTarget(extended, .6f); } else if (type.Contains(AnimationType.hammerHitLoweredLeftArm) && !inverted) { currentTarget = new MovementTarget(folded, .2f); } else if (type.Contains(AnimationType.hammerHitRaisedLeftArm) && !inverted) { currentTarget = new MovementTarget(extended, .2f); } else if (type.Contains(AnimationType.running) || type.Contains(AnimationType.walking)) { if (parentArm != null) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((-parentArm.parentSwingTime / 2 + (inverted ? 1 : -1) * (2 - MathHelper.ToRadians(90))), (inverted ? 1 : -1) * walkArmSwingAmount * (inverted ? 1 : 1) * 0, 0), .2f); } } else if (type.Contains(AnimationType.standing)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll((0 ), 0, MathHelper.ToRadians(1)), .2f); } lerpRotation(); }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { if (type.Contains(AnimationType.walking) || type.Contains(AnimationType.running)) { //rotation = Quaternion.CreateFromYawPitchRoll(-((TorsoAnimation)parent).getYaw()/1f, 0, 0); TorsoAnimation torso = parent as TorsoAnimation; if (torso != null) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(-(torso).getYaw() * 1f, 0, 0), .09f); } } else { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .09f); } //currentAnimation = taskType; //rotation = Quaternion.Slerp(rotation, currentTarget.goal, currentTarget.floatingCameraSpeed / AnimationFunctions.angleBetweenQuaternions(rotation, currentTarget.goal)); lerpRotation(); }
public override void handleOrder(List <AnimationType> types, AnimationSystem parent) { TorsoAnimation torso = parent as TorsoAnimation; if (torso != null) { parentSwingTime = torso.swingTime; } if (types.Contains(AnimationType.armsOut)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, 0), .200000f); Console.WriteLine("arms out"); } else if (types.Contains(AnimationType.stabLeftArm) && !inverted) { currentTarget = new MovementTarget(stabbedForward, .6f); } else if (types.Contains(AnimationType.stabRightArm) && inverted) { currentTarget = new MovementTarget(stabbedForward, .6f); } else if (types.Contains(AnimationType.hammerHitLoweredLeftArm) && !inverted) { currentTarget = new MovementTarget(loweredHammer, .3f); } else if (types.Contains(AnimationType.hammerHitRaisedLeftArm) && !inverted) { currentTarget = new MovementTarget(raised, .3f); } else if (types.Contains(AnimationType.walking) || types.Contains(AnimationType.running)) { float armSwingToUse = walkArmSwingAmount; if (inverted) { if (types.Contains(AnimationType.toolInRightHand)) { parentSwingTime /= 3f; } } else { if (types.Contains(AnimationType.toolInLeftHand)) { parentSwingTime /= 3f; } } //rotation = Quaternion.CreateFromYawPitchRoll(0, (inverted ? -1 : 1) * walkArmSwingAmount * parentSwingTime, (inverted ? -1 : 1) * MathHelper.ToRadians(90)); currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, (inverted ? -1 : 1) * armSwingToUse * parentSwingTime, (inverted ? -1 : 1) * MathHelper.ToRadians(90)), .2f); } else if (types.Contains(AnimationType.standing)) { currentTarget = new MovementTarget(Quaternion.CreateFromYawPitchRoll(0, 0, (inverted ? -1 : 1) * MathHelper.ToRadians(85)), .2f); } lerpRotation(); }
public BodyPart() { rotationOffset = Quaternion.Identity; children = new List <BodyPart>(); animationSystem = new noAnimation(); }
public override void handleOrder(List <AnimationType> type, AnimationSystem parent) { }
public abstract void handleOrder(List <AnimationType> typem, AnimationSystem parent);