Пример #1
0
        /// <summary>
        /// Creates the internal representation of the Joint and restores the values saved by the Component.
        /// </summary>
        private void RestoreNative()
        {
            // Make sure to always create a new instance of this array, as IntPtrs don't get serialized
            [email protected] = new [] { IntPtr.Zero, IntPtr.Zero };

            if (commonData.bodies[0] != null)
            {
                NativeRigidbody nativeBody = commonData.bodies[0].native;
                if (nativeBody != null)
                {
                    [email protected][0] = nativeBody.GetCachedPtr();
                }
            }

            if (commonData.bodies[1] != null)
            {
                NativeRigidbody nativeBody = commonData.bodies[1].native;
                if (nativeBody != null)
                {
                    [email protected][1] = nativeBody.GetCachedPtr();
                }
            }

            GetLocalTransform(JointBody.Target, out [email protected][0], out [email protected][0]);
            GetLocalTransform(JointBody.Anchor, out [email protected][1], out [email protected][1]);

            native           = CreateNative();
            native.Component = this;
        }
Пример #2
0
 /// <summary>
 /// Destroys the internal joint representation.
 /// </summary>
 private void DestroyNative()
 {
     if (native != null)
     {
         native.Destroy();
         native = null;
     }
 }
Пример #3
0
 /// <summary>
 /// Destroys the internal joint representation.
 /// </summary>
 private void DestroyNative()
 {
     if (native != null)
     {
         native.Destroy();
         native = null;
     }
 }
Пример #4
0
        /// <summary>
        /// Creates the internal representation of the Joint and restores the values saved by the Component.
        /// </summary>
        private void RestoreNative()
        {
            // Make sure to always create a new instance of this array, as IntPtrs don't get serialized
            [email protected] = new []{ IntPtr.Zero, IntPtr.Zero };

            if (commonData.bodies[0] != null)
            {
                NativeRigidbody nativeBody = commonData.bodies[0].native;
                if (nativeBody != null)
                    [email protected][0] = nativeBody.GetCachedPtr();
            }

            if (commonData.bodies[1] != null)
            {
                NativeRigidbody nativeBody = commonData.bodies[1].native;
                if (nativeBody != null)
                    [email protected][1] = nativeBody.GetCachedPtr();
            }

            GetLocalTransform(JointBody.Target, out [email protected][0], out [email protected][0]);
            GetLocalTransform(JointBody.Anchor, out [email protected][1], out [email protected][1]);

            native = CreateNative();
            native.Component = this;
        }