internal void ApplyPatch(RigidBodyPatch patch)
 {
     // Apply any changes made to the state of the mixed reality extension runtime version of the rigid body.
     if (patch.Velocity != null && patch.Velocity.IsPatched())
     {
         _rigidbody.velocity = _rigidbody.velocity.GetPatchApplied(_sceneRoot.TransformDirection(Velocity.ApplyPatch(patch.Velocity).ToVector3()));
     }
     if (patch.AngularVelocity != null && patch.AngularVelocity.IsPatched())
     {
         _rigidbody.angularVelocity = _rigidbody.angularVelocity.GetPatchApplied(_sceneRoot.TransformDirection(AngularVelocity.ApplyPatch(patch.AngularVelocity).ToVector3()));
     }
     if (patch.Mass.HasValue)
     {
         _rigidbody.mass = _rigidbody.mass.GetPatchApplied(Mass.ApplyPatch(patch.Mass));
     }
     if (patch.DetectCollisions.HasValue)
     {
         _rigidbody.detectCollisions = _rigidbody.detectCollisions.GetPatchApplied(DetectCollisions.ApplyPatch(patch.DetectCollisions));
     }
     if (patch.CollisionDetectionMode.HasValue)
     {
         _rigidbody.collisionDetectionMode = _rigidbody.collisionDetectionMode.GetPatchApplied(CollisionDetectionMode.ApplyPatch(patch.CollisionDetectionMode));
     }
     if (patch.UseGravity.HasValue)
     {
         _rigidbody.useGravity = _rigidbody.useGravity.GetPatchApplied(UseGravity.ApplyPatch(patch.UseGravity));
     }
     if (patch.IsKinematic.HasValue)
     {
         _rigidbody.isKinematic = _rigidbody.isKinematic.GetPatchApplied(IsKinematic.ApplyPatch(patch.IsKinematic));
     }
     _rigidbody.constraints = (RigidbodyConstraints)((int)_rigidbody.constraints).GetPatchApplied((int)ConstraintFlags.ApplyPatch(patch.ConstraintFlags));
 }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (position_ != null)
            {
                hash ^= Position.GetHashCode();
            }
            if (velocity_ != null)
            {
                hash ^= Velocity.GetHashCode();
            }
            if (force_ != null)
            {
                hash ^= Force.GetHashCode();
            }
            if (IsKinematic != false)
            {
                hash ^= IsKinematic.GetHashCode();
            }
            if (MagicalExtraOne != 0)
            {
                hash ^= MagicalExtraOne.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }