Example #1
0
        /// <summary>
        /// Applies this force to a specified object
        /// </summary>
        /// <param name="toObject">The specified object</param>
        public void Apply(IForceable toObject)
        {
            float accelerationValue = this.Value / toObject.Mass;                     // F = m.a  ==> a = F/m
            float accelerationAngle = (this.Angle + toObject.Acceleration.Angle) / 2; // the angle between 2 angles

            toObject.Acceleration = new Vector(accelerationValue, accelerationAngle);
        }
Example #2
0
        private void OnForceApplied(IForceable source, ForceArgs args)
        {
            HitReceiver receiver   = (HitReceiver)source;
            HitboxID    hitboxId   = receiver.HitboxID;
            Vector3     totalForce = args.Force * hitboxMapper[hitboxId].ForceMultiplier;

            var bone = receiver.GetComponent <RagdollBone>();

            bone.ApplyForce(new ForceArgs(args.Origin, args.Dealer, totalForce));
        }
Example #3
0
 /// <summary>
 /// Applies this force to a specified object
 /// </summary>
 /// <param name="toObject">The specified object</param>
 public void Apply(IForceable toObject)
 {
     float accelerationValue = this.Value / toObject.Mass; // F = m.a  ==> a = F/m
     float accelerationAngle = (this.Angle + toObject.Acceleration.Angle) / 2; // the angle between 2 angles
     toObject.Acceleration = new Vector(accelerationValue, accelerationAngle);
 }
Example #4
0
 /// <summary>
 /// Прилага силата в/у даден IForceable обект
 /// </summary>
 /// <param name="toObject">Обекта в/у който прилагаме силата</param>
 public void Apply(IForceable toObject)
 {
     toObject.Acceleration = this / toObject.Mass;    //a = F / m
 }
Example #5
0
 /// <summary>
 /// Прилага силата в/у даден IForceable обект
 /// </summary>
 /// <param name="toObject">Обекта в/у който прилагаме силата</param>
 public void Apply(IForceable toObject)
 {
     toObject.Acceleration = this / toObject.Mass;    //a = F / m
 }
Example #6
0
 public void Force(IForceable forceable)
 {
     forceable.ApplyForce(new ForceArgs(Origin, gameObject, ForceDirection * force));
     Forced?.Invoke(this);
 }