Пример #1
0
        public override Solid CreateSolid()
        {
            Solid newSolid = new OdeSolid(world, space);

            AddSolid(newSolid);
            return(newSolid);
        }
Пример #2
0
        /// Attaches the ODE Joint to the given ODESolids.
        protected virtual void AttachODEBodies(Solid s0, Solid s1)
        {
            OdeSolid solid0 = s0 as  OdeSolid;
            OdeSolid solid1 = s1 as OdeSolid;

            if (null == solid0 && null == solid1)
            {
                Tao.Ode.Ode.dJointAttach(jointID, IntPtr.Zero, IntPtr.Zero);
                if (JointType.Ball == data.Type)
                {
                    Tao.Ode.Ode.dJointAttach(aMotorID, IntPtr.Zero, IntPtr.Zero);
                }
            }
            else
            {
                if (null == solid0)
                {
                    Tao.Ode.Ode.dJointAttach(jointID, IntPtr.Zero, solid1.InternalGetBodyID());
                    if (JointType.Ball == data.Type)
                    {
                        Tao.Ode.Ode.dJointAttach(aMotorID, IntPtr.Zero, solid1.InternalGetBodyID());
                    }
                }
                else if (null == solid1)
                {
                    Tao.Ode.Ode.dJointAttach(jointID, solid0.InternalGetBodyID(), IntPtr.Zero);
                    if (JointType.Ball == data.Type)
                    {
                        Tao.Ode.Ode.dJointAttach(aMotorID, solid0.InternalGetBodyID(), IntPtr.Zero);
                    }
                }
                else
                {
                    Tao.Ode.Ode.dJointAttach(jointID, solid0.InternalGetBodyID(),
                                             solid1.InternalGetBodyID());
                    if (JointType.Ball == data.Type)
                    {
                        Tao.Ode.Ode.dJointAttach(aMotorID, solid0.InternalGetBodyID(),
                                                 solid1.InternalGetBodyID());
                    }
                }

                // Special call for fixed Joints so they remember the current
                // relationship between the Solids or between a Solid and the
                // static environment.
                if (JointType.Fixed == data.Type)
                {
                    Tao.Ode.Ode.dJointSetFixed(jointID);
                }
            }
        }
Пример #3
0
        public void InternalAddCollidedSolid(Solid solid)
        {
            // If the collided Solid is attached to the Sensor performing the
            // volume query, ignore this intersection.
            if (sensorSolid == solid)
            {
                return;
            }

            OdeSolid osolid = solid as OdeSolid;

            if (osolid.CollisionCount != collisionCount)
            {
                volumeQueryResult.InternalAddSolid(solid);
                osolid.CollisionCount = collisionCount;
            }
        }