Esempio n. 1
0
        public void SyncWithPhysics(bool overrideAll)
        {
            if (_radiusOverride || overrideAll)
            {
                _body.Radius    = _radius;
                _radiusOverride = false;
            }
            else
            {
                if (_radius != _body.Radius)
                {
                    StateTracker.UpdateBlob(this);
                }

                _radius = _body.Radius;
            }

            if (_positionOverride || overrideAll)
            {
                _body.Position    = _position;
                _positionOverride = false;
            }
            else
            {
                if (_position != _body.Position)
                {
                    StateTracker.UpdateBlob(this);
                }

                _position = _body.Position;
            }

            if (_body.IsStatic)
            {
                return;
            }

            if (_velocityOverride || overrideAll)
            {
                _body.LinearVelocity = _velocity;
                _velocityOverride    = false;
            }
            else
            {
                _velocity = _body.LinearVelocity;
            }

            if (_massOverride || overrideAll)
            {
                _body.Mass    = _mass;
                _massOverride = false;
            }
            else
            {
                _mass = _body.Mass;
            }
        }