Esempio n. 1
0
        /// <summary>
        /// Destroys the internal collider representation.
        /// </summary>
        private void DestroyNative()
        {
            if (parent != null)
            {
                parent.RemoveCollider(this);
            }

            parent = null;

            if (native != null)
            {
                native.Destroy();
                native = null;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the internal representation of the Collider and restores the values saved by the Component.
        /// </summary>
        private void RestoreNative()
        {
            native = CreateCollider();

            native.Component     = this;
            native.Position      = serializableData.localPosition;
            native.Rotation      = serializableData.localRotation;
            native.IsTrigger     = serializableData.isTrigger;
            native.Mass          = serializableData.mass;
            native.Material      = serializableData.material;
            native.ContactOffset = serializableData.contactOffset;
            native.RestOffset    = serializableData.restOffset;
            native.Layer         = serializableData.layer;

            UpdateParentRigidbody();
            UpdateTransform();
            UpdateCollisionReportMode();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the internal representation of the Collider and restores the values saved by the Component.
        /// </summary>
        private void RestoreNative()
        {
            native = CreateCollider();

            native.Component = this;
            native.Position = serializableData.localPosition;
            native.Rotation = serializableData.localRotation;
            native.IsTrigger = serializableData.isTrigger;
            native.Mass = serializableData.mass;
            native.Material = serializableData.material;
            native.ContactOffset = serializableData.contactOffset;
            native.RestOffset = serializableData.restOffset;
            native.Layer = serializableData.layer;

            UpdateParentRigidbody();
            UpdateTransform();
            UpdateCollisionReportMode();
        }
Esempio n. 4
0
        /// <summary>
        /// Converts an array of native colliders to collider components.
        /// </summary>
        /// <param name="colliders">Native colliders.</param>
        /// <returns>Managed collider components.</returns>
        private static Collider[] ConvertColliders(NativeCollider[] colliders)
        {
            Collider[] output = new Collider[colliders.Length];
            for (int i = 0; i < colliders.Length; i++)
                output[i] = colliders[i].Component;

            return output;
        }
Esempio n. 5
0
        /// <summary>
        /// Destroys the internal collider representation.
        /// </summary>
        private void DestroyNative()
        {
            if (parent != null)
                parent.RemoveCollider(this);

            parent = null;

            if (native != null)
            {
                native.Destroy();
                native = null;
            }
        }