internal void Dispose()
        {
            if (Body.isInWorld())
            {
                m_parent_scene.removeFromWorld(Body);
            }

            if (m_aMotor.Handle != IntPtr.Zero)
            {
                m_parent_scene.getBulletWorld().removeConstraint(m_aMotor);
            }

            m_aMotor.Dispose(); m_aMotor = null;
            ClosestCastResult.Dispose(); ClosestCastResult = null;
            Body.Dispose(); Body   = null;
            Shell.Dispose(); Shell = null;
            tempQuat1.Dispose();
            tempTrans1.Dispose();
            tempVector1.Dispose();
            tempVector2.Dispose();
            tempVector3.Dispose();
            tempVector4.Dispose();
            tempVector5RayCast.Dispose();
            tempVector6RayCast.Dispose();
        }
Пример #2
0
        public new btCollisionShape getCollisionShape()
        {
            global::System.IntPtr cPtr = BulletPINVOKE.btRigidBody_getCollisionShape__SWIG_0(swigCPtr);
            btCollisionShape      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new btCollisionShape(cPtr, false);

            return(ret);
        }
Пример #3
0
 public btCollisionObjectWrapper(btCollisionObjectWrapper parent, btCollisionShape shape, btCollisionObject collisionObject, btTransform worldTransform, int partId, int index) : this(BulletPINVOKE.new_btCollisionObjectWrapper(btCollisionObjectWrapper.getCPtr(parent), btCollisionShape.getCPtr(shape), btCollisionObject.getCPtr(collisionObject), btTransform.getCPtr(worldTransform), partId, index), true)
 {
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #4
0
 public btRigidBody(float mass, btMotionState motionState, btCollisionShape collisionShape, btVector3 localInertia) : this(BulletPINVOKE.new_btRigidBody__SWIG_1(mass, btMotionState.getCPtr(motionState), btCollisionShape.getCPtr(collisionShape), btVector3.getCPtr(localInertia)), true)
 {
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #5
0
        public btCollisionShape getCollisionShape()
        {
            global::System.IntPtr cPtr = BulletPINVOKE.btCollisionObjectWrapper_getCollisionShape(swigCPtr);
            btCollisionShape      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new btCollisionShape(cPtr, false);

            return(ret);
        }
Пример #6
0
 public virtual void debugDrawObject(btTransform worldTransform, btCollisionShape shape, btVector3 color)
 {
     BulletPINVOKE.btCollisionWorld_debugDrawObject(swigCPtr, btTransform.getCPtr(worldTransform), btCollisionShape.getCPtr(shape), btVector3.getCPtr(color));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #7
0
 public void addChildShape(btTransform localTransform, btCollisionShape shape)
 {
     BulletPINVOKE.btCompoundShape_addChildShape(swigCPtr, btTransform.getCPtr(localTransform), btCollisionShape.getCPtr(shape));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #8
0
        internal void Dispose()
        {
            m_parent_scene.RemoveAvatarFromList(this);
            if (Body != null)
            {
                if (Body.isInWorld())
                {
                    m_parent_scene.removeFromWorld(this, Body);
                    m_parent_scene.RemoveCollisionObject(Body);
                }
                Body.Dispose();
                Body = null;
            }

            if (m_aMotor != null)
            {
                if (m_aMotor.Handle != IntPtr.Zero)
                {
                    m_parent_scene.getBulletWorld().removeConstraint(m_aMotor);
                }

                m_aMotor.Dispose(); m_aMotor = null;
            }
            if (ClosestCastResult != null)
            {
                ClosestCastResult.Dispose(); ClosestCastResult = null;
            }
            if (Shell != null)
            {
                Shell.Dispose(); Shell = null;
            }
            tempQuat1.Dispose();
            tempTrans1.Dispose();
            tempVector1.Dispose();
            tempVector2.Dispose();
            tempVector3.Dispose();
            tempVector4.Dispose();
            tempVector5RayCast.Dispose();
            tempVector6RayCast.Dispose();
        }
Пример #9
0
 public virtual void setCollisionShape(btCollisionShape collisionShape)
 {
     BulletPINVOKE.btCollisionObject_setCollisionShape(swigCPtr, btCollisionShape.getCPtr(collisionShape));
 }
Пример #10
0
 public static void rayTestSingle(btTransform rayFromTrans, btTransform rayToTrans, btCollisionObject collisionObject, btCollisionShape collisionShape, btTransform colObjWorldTransform, btCollisionWorld.RayResultCallback resultCallback)
 {
     BulletPINVOKE.btCollisionWorld_rayTestSingle(btTransform.getCPtr(rayFromTrans), btTransform.getCPtr(rayToTrans), btCollisionObject.getCPtr(collisionObject), btCollisionShape.getCPtr(collisionShape), btTransform.getCPtr(colObjWorldTransform), btCollisionWorld.RayResultCallback.getCPtr(resultCallback));
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #11
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(btCollisionShape obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
	void gimpact_vs_shape(btCollisionObjectWrapper* body0Wrap,
					  btCollisionObjectWrapper* body1Wrap,
					  btGImpactShapeInterface * shape0,
					  btCollisionShape * shape1,bool swapped);
Пример #13
0
        /// <summary>
        /// This creates the Avatar's physical Surrogate at the position supplied
        /// </summary>
        /// <param name="npositionX"></param>
        /// <param name="npositionY"></param>
        /// <param name="npositionZ"></param>

        // WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
        // to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
        // place that is safe to call this routine AvatarGeomAndBodyCreation.
        private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ)
        {
            if (CAPSULE_LENGTH <= 0)
            {
                m_log.Warn("[PHYSICS]: The capsule size you specified in aurora.ini is invalid!  Setting it to the smallest possible size!");
                CAPSULE_LENGTH = 0.01f;
            }

            if (CAPSULE_RADIUS <= 0)
            {
                m_log.Warn("[PHYSICS]: The capsule size you specified in aurora.ini is invalid!  Setting it to the smallest possible size!");
                CAPSULE_RADIUS = 0.01f;
            }

            Shell = new btCapsuleShape(CAPSULE_RADIUS, CAPSULE_LENGTH);

            if (m_bodyPosition == null)
            {
                m_bodyPosition = new btVector3(npositionX, npositionY, npositionZ);
            }

            m_bodyPosition.setValue(npositionX, npositionY, npositionZ);

            if (m_bodyOrientation == null)
            {
                m_bodyOrientation = new btQuaternion(m_CapsuleOrientationAxis, (Utils.DEG_TO_RAD * 90));
            }

            if (m_bodyTransform == null)
            {
                m_bodyTransform = new btTransform(m_bodyOrientation, m_bodyPosition);
            }
            else
            {
                m_bodyTransform.Dispose();
                m_bodyTransform = new btTransform(m_bodyOrientation, m_bodyPosition);
            }

            if (m_bodyMotionState == null)
            {
                m_bodyMotionState = new btDefaultMotionState(m_bodyTransform);
            }
            else
            {
                m_bodyMotionState.setWorldTransform(m_bodyTransform);
            }

            m_mass = Mass;

            Body = new btRigidBody(m_mass, m_bodyMotionState, Shell);
            // this is used for self identification. User localID instead of body handle
            Body.setUserPointer(new IntPtr((int)m_localID));

            if (ClosestCastResult != null)
            {
                ClosestCastResult.Dispose();
            }
            ClosestCastResult = new ClosestNotMeRayResultCallback(Body);

            m_parent_scene.AddRigidBody(Body);
            Body.setActivationState(4);
            if (m_aMotor != null)
            {
                if (m_aMotor.Handle != IntPtr.Zero)
                {
                    m_parent_scene.getBulletWorld().removeConstraint(m_aMotor);
                    m_aMotor.Dispose();
                }
                m_aMotor = null;
            }

            m_aMotor = new btGeneric6DofConstraint(Body, m_parent_scene.TerrainBody,
                                                   m_parent_scene.TransZero,
                                                   m_parent_scene.TransZero, false);
            m_aMotor.setAngularLowerLimit(m_parent_scene.VectorZero);
            m_aMotor.setAngularUpperLimit(m_parent_scene.VectorZero);
        }
	void convex_vs_convex_collision(btCollisionObjectWrapper* body0Wrap,
					  btCollisionObjectWrapper* body1Wrap,
					  btCollisionShape* shape0,
					  btCollisionShape* shape1);
	void gimpact_vs_shape_find_pairs(
					  btTransform & trans0,
					  btTransform & trans1,
					  btGImpactShapeInterface * shape0,
					  btCollisionShape * shape1,
					  btList<int> & collided_primitives);
	void shape_vs_shape_collision(
					  btCollisionObjectWrapper* body0,
					  btCollisionObjectWrapper* body1,
					  btCollisionShape * shape0,
					  btCollisionShape * shape1);
Пример #17
0
 public virtual void removeChildShape(btCollisionShape shape)
 {
     BulletPINVOKE.btCompoundShape_removeChildShape(swigCPtr, btCollisionShape.getCPtr(shape));
 }
Пример #18
0
 public static void objectQuerySingle(btConvexShape castShape, btTransform rayFromTrans, btTransform rayToTrans, btCollisionObject collisionObject, btCollisionShape collisionShape, btTransform colObjWorldTransform, btCollisionWorld.ConvexResultCallback resultCallback, float allowedPenetration)
 {
     BulletPINVOKE.btCollisionWorld_objectQuerySingle(btConvexShape.getCPtr(castShape), btTransform.getCPtr(rayFromTrans), btTransform.getCPtr(rayToTrans), btCollisionObject.getCPtr(collisionObject), btCollisionShape.getCPtr(collisionShape), btTransform.getCPtr(colObjWorldTransform), btCollisionWorld.ConvexResultCallback.getCPtr(resultCallback), allowedPenetration);
     if (BulletPINVOKE.SWIGPendingException.Pending)
     {
         throw BulletPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #19
0
 public btRigidBody(float mass, btMotionState motionState, btCollisionShape collisionShape) : this(BulletPINVOKE.new_btRigidBody__SWIG_2(mass, btMotionState.getCPtr(motionState), btCollisionShape.getCPtr(collisionShape)), true)
 {
 }
Пример #20
0
	///those virtuals are called by load and can be overridden by the user



	//bodies

	virtual btCollisionObject  createCollisionObject(	ref btTransform startTransform,	btCollisionShape* shape,string bodyName);