OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
/// <summary>
/// Make a prim subject to physics.
/// </summary>
Make a prim subject to physics.
Make a prim subject to physics .
private void enableBody()
        {
            if (!childPrim)
            {
                Body = d.BodyCreate(_parent_scene.world);
                setMass();
                d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
                d.Quaternion myrot = new d.Quaternion();
                myrot.X = _orientation.X;
                myrot.Y = _orientation.Y;
                myrot.Z = _orientation.Z;
                myrot.W = _orientation.W;
                d.BodySetQuaternion(Body, ref myrot);
                d.GeomSetBody(prim_geom, Body);
                if (m_assetFailed)
                {
                    d.GeomSetCategoryBits(prim_geom, 0);
                    d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits);
                }
                else
                {
                    m_collisionCategories |= CollisionCategories.Body;
                    m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
                }
                d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
                d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
                d.BodySetAutoDisableFlag(Body, true);
                d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
                d.BodySetGravityMode (Body, false);
                m_interpenetrationcount = 0;
                m_collisionscore = 0;
                m_disabled = false;
                if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null)
                {
                    createAMotor(m_angularlock);
                }
                if (m_vehicle.Type != Vehicle.TYPE_NONE)
                {
                    m_vehicle.Enable(Body, _parent_scene);
                }
                _parent_scene.ActivatePrim(this);
            }
        }
private void enableBody ( ) { if ( ! childPrim ) { Body = d . BodyCreate ( _parent_scene . world ) ; setMass ( ) ; d . BodySetPosition ( Body , _position . X , _position . Y , _position . Z ) ; d . Quaternion myrot = new d . Quaternion ( ) ; myrot . X = _orientation . X ; myrot . Y = _orientation . Y ; myrot . Z = _orientation . Z ; myrot . W = _orientation . W ; d . BodySetQuaternion ( Body , ref myrot ) ; d . GeomSetBody ( prim_geom , Body ) ; if ( m_assetFailed ) { d . GeomSetCategoryBits ( prim_geom , 0 ) ; d . GeomSetCollideBits ( prim_geom , BadMeshAssetCollideBits ) ; } else { m_collisionCategories |= CollisionCategories . Body ; m_collisionFlags |= ( CollisionCategories . Land | CollisionCategories . Wind ) ; } d . GeomSetCategoryBits ( prim_geom , ( int ) m_collisionCategories ) ; d . GeomSetCollideBits ( prim_geom , ( int ) m_collisionFlags ) ; d . BodySetAutoDisableFlag ( Body , true ) ; d . BodySetAutoDisableSteps ( Body , body_autodisable_frames ) ; d . BodySetGravityMode ( Body , false ) ; m_interpenetrationcount = 0 ; m_collisionscore = 0 ; m_disabled = false ; if ( ( ! m_angularlock . ApproxEquals ( Vector3 . Zero , 0.0f ) ) && _parent == null ) { createAMotor ( m_angularlock ) ; } if ( m_vehicle . Type != Vehicle . TYPE_NONE ) { m_vehicle . Enable ( Body , _parent_scene ) ; } _parent_scene . ActivatePrim ( this ) ; } }
Make a prim subject to physics.
Make a prim subject to physics .
// Don't enable this body if we're a child prim // this should be taken care of in the parent function not here // Sets the geom to a body // disconnect from world gravity so we can apply buoyancy // The body doesn't already have a finite rotation mode set here