Example #1
0
 protected override void OnContact(ItemContactState contactState, Single deltaTime)
 {
     _IsContactOcurred = true;
     if (_MaxDepth < contactState.Contact.Depth)
     {
         _MaxDepth      = contactState.Contact.Depth;
         _MaxDepthState = contactState;
     }
     if (Scale.Y < _SpringContractedY || _TotalContraction < 0 ||
         !Vector3.Dot(_Collider.Top, contactState.Normal).TolerantEquals(1))
     {
         if (_TotalContraction < 0)
         {
             _Contract(-_TotalContraction);
             if (_SoundEffect != null)
             {
                 _SoundEffect.play(false);
             }
             _TotalContraction = 0;
         }
         base.OnContact(contactState, deltaTime);
     }
     else
     {
         contactState.Interactive.AddForceAt(contactState.Radius, _RealElasticity * _TotalContraction * _Collider.Top);
     }
 }
Example #2
0
 protected override void OnRestitutiveContact(ItemContactState contactState)
 {
     if (Scale.Y < _SpringContractedY ||
         !Vector3.Dot(_Collider.Top, contactState.Normal).TolerantEquals(1))
     {
         base.OnRestitutiveContact(contactState);
     }
 }
        public virtual Boolean React(ItemContactState contactState, Single deltaTime)
        {
            var reacted = false;

            if (contactState.TimesReacted == 0)
            {
                OnContact(contactState, deltaTime);
                reacted = true;
            }
            if (contactState.Weight > 0)
            {
                OnRestingContact(contactState);
                reacted = true;
            }
            if (contactState.Approach > 0)
            {
                OnRestitutiveContact(contactState);
                reacted = true;
            }
            return(reacted);
        }
Example #4
0
 public override Boolean React(ItemContactState contactState, Single deltaTime)
 {
     return(false);
 }
 public override Boolean React(ItemContactState contactState, Single deltaTime)
 {
     return false;
 }
 protected virtual void OnRestingContact(ItemContactState contactState)
 {
     contactState.ApplyFriction();
 }
 protected virtual void OnRestitutiveContact(ItemContactState contactState)
 {
     contactState.ApplyRestitution();
 }
Example #8
0
 protected virtual void OnContact(ItemContactState contactState, Single deltaTime)
 {
     contactState.ApplyMinimumTranslation();
 }
Example #9
0
 protected override void OnRestitutiveContact(ItemContactState contactState)
 {
     if (Scale.Y < _SpringContractedY
     || !Vector3.Dot(_Collider.Top, contactState.Normal).TolerantEquals(1))
         base.OnRestitutiveContact(contactState);
 }
Example #10
0
 public override void Animate(Single deltaTime)
 {
     if (_MaxDepthState != null)
     {
         var contraction = _MaxDepthState.ComputeApproachVelocity() * deltaTime;
         _Contract(contraction);
         _MaxDepthState = null;
         _MaxDepth = 0;
     }
     else if (!_IsContactOcurred && _TotalContraction > 0)
         _Contract(-_SpringElasticVelocityY * deltaTime * Scale.Y);
     _IsContactOcurred = false;
 }
Example #11
0
 protected override void OnContact(ItemContactState contactState, Single deltaTime)
 {
     _IsContactOcurred = true;
     if (_MaxDepth < contactState.Contact.Depth)
     {
         _MaxDepth = contactState.Contact.Depth;
         _MaxDepthState = contactState;
     }
     if (Scale.Y < _SpringContractedY || _TotalContraction < 0
     || !Vector3.Dot(_Collider.Top, contactState.Normal).TolerantEquals(1))
     {
         if (_TotalContraction < 0)
         {
             _Contract(-_TotalContraction);
             if (_SoundEffect != null)
                 _SoundEffect.play(false);
             _TotalContraction = 0;
         }
         base.OnContact(contactState, deltaTime);
     }
     else contactState.Interactive.AddForceAt(contactState.Radius, _RealElasticity * _TotalContraction * _Collider.Top);
 }
Example #12
0
 protected virtual void OnRestitutiveContact(ItemContactState contactState)
 {
     contactState.ApplyRestitution();
 }
Example #13
0
 protected virtual void OnRestingContact(ItemContactState contactState)
 {
     contactState.ApplyFriction();
 }
 protected override void OnContact(ItemContactState contactState, Single deltaTime)
 {
     base.OnContact(contactState, deltaTime);
     _Dust.Start(contactState.Point, contactState.Approach, contactState.Normal);
 }
 protected virtual void OnContact(ItemContactState contactState, Single deltaTime)
 {
     contactState.ApplyMinimumTranslation();
 }
Example #16
0
 protected override void OnContact(ItemContactState contactState, Single deltaTime)
 {
     base.OnContact(contactState, deltaTime);
     _Dust.Start(contactState.Point, contactState.Approach, contactState.Normal);
 }
Example #17
0
 public virtual Boolean React(ItemContactState contactState, Single deltaTime)
 {
     var reacted = false;
     if (contactState.TimesReacted == 0)
     {
         OnContact(contactState, deltaTime);
         reacted = true;
     }
     if (contactState.Weight > 0)
     {
         OnRestingContact(contactState);
         reacted = true;
     }
     if (contactState.Approach > 0)
     {
         OnRestitutiveContact(contactState);
         reacted = true;
     }
     return reacted;
 }