Esempio n. 1
0
        /// <summary>
        /// Add shape to a rigid body instance.
        /// NOTE: This method is used by the RigidBody object.
        /// </summary>
        /// <param name="rb"></param>
        public void SetRigidBody(RigidBody rb)
        {
            if (m_geometry == null || m_geometry.getShapes().Count == 0 || m_geometry.getRigidBody() != null)
            {
                return;
            }

            // Search in our game object for rigid body and remove this?
            if (!rb.gameObject.HasChild(gameObject))
            {
                throw new Exception("RigidBody not parent to Shape.");
            }

            m_geometry.setEnable(IsEnabled);

            rb.Native.add(m_geometry, GetNativeRigidBodyOffset(rb));
        }
Esempio n. 2
0
        /// <summary>
        /// Add shape to a rigid body instance.
        /// NOTE: This method is used by the RigidBody object.
        /// </summary>
        /// <param name="rb"></param>
        public void SetRigidBody(RigidBody rb)
        {
            if (m_geometry == null || m_geometry.getShapes().Count == 0 || m_geometry.getRigidBody() != null)
            {
                return;
            }

            // Search in our game object for rigid body and remove this?
            if (!rb.gameObject.HasChild(gameObject))
            {
                throw new Exception("RigidBody not parent to Shape.");
            }

            m_geometry.setEnable(IsEnabled);

            rb.Native.add(m_geometry, GetNativeRigidBodyOffset(rb));

            // Removing us from synchronization the transform since
            // we're implicitly updated from the synchronization of
            // the body.
            Simulation.Instance.StepCallbacks.PostSynchronizeTransforms -= OnPostSynchronizeTransformsCallback;
        }