OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
/// <summary>
/// Change prim in response to a selection taint.
/// </summary>
Change prim in response to a selection taint.
Change prim in response to a selection taint .
private void changeSelectedStatus()
        {
            if (m_taintselected)
            {
                m_collisionCategories = CollisionCategories.Selected;
                m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
                if (IsPhysical)
                {
                    disableBodySoft();
                }
                if (m_assetFailed)
                {
                    d.GeomSetCategoryBits(prim_geom, 0);
                    d.GeomSetCollideBits(prim_geom, 0);
                }
                else
                {
                    d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
                    d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
                }
                if (IsPhysical)
                {
                    disableBodySoft();
                }
            }
            else
            {
                m_collisionCategories = CollisionCategories.Geom;
                if (IsPhysical)
                    m_collisionCategories |= CollisionCategories.Body;
                m_collisionFlags = m_default_collisionFlags;
                if (m_collidesLand)
                    m_collisionFlags |= CollisionCategories.Land;
                if (m_collidesWater)
                    m_collisionFlags |= CollisionCategories.Water;
                if (m_assetFailed)
                {
                    d.GeomSetCategoryBits(prim_geom, 0);
                    d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits);
                }
                else
                {
                    d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
                    d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
                }
                if (IsPhysical)
                {
                    if (Body != IntPtr.Zero)
                    {
                        d.BodySetLinearVel(Body, 0f, 0f, 0f);
                        d.BodySetForce(Body, 0, 0, 0);
                        enableBodySoft();
                    }
                }
            }
            resetCollisionAccounting();
            m_isSelected = m_taintselected;
        }
private void changeSelectedStatus ( ) { if ( m_taintselected ) { m_collisionCategories = CollisionCategories . Selected ; m_collisionFlags = ( CollisionCategories . Sensor | CollisionCategories . Space ) ; if ( IsPhysical ) { disableBodySoft ( ) ; } if ( m_assetFailed ) { d . GeomSetCategoryBits ( prim_geom , 0 ) ; d . GeomSetCollideBits ( prim_geom , 0 ) ; } else { d . GeomSetCategoryBits ( prim_geom , ( int ) m_collisionCategories ) ; d . GeomSetCollideBits ( prim_geom , ( int ) m_collisionFlags ) ; } if ( IsPhysical ) { disableBodySoft ( ) ; } } else { m_collisionCategories = CollisionCategories . Geom ; if ( IsPhysical ) m_collisionCategories |= CollisionCategories . Body ; m_collisionFlags = m_default_collisionFlags ; if ( m_collidesLand ) m_collisionFlags |= CollisionCategories . Land ; if ( m_collidesWater ) m_collisionFlags |= CollisionCategories . Water ; if ( m_assetFailed ) { d . GeomSetCategoryBits ( prim_geom , 0 ) ; d . GeomSetCollideBits ( prim_geom , BadMeshAssetCollideBits ) ; } else { d . GeomSetCategoryBits ( prim_geom , ( int ) m_collisionCategories ) ; d . GeomSetCollideBits ( prim_geom , ( int ) m_collisionFlags ) ; } if ( IsPhysical ) { if ( Body != IntPtr . Zero ) { d . BodySetLinearVel ( Body , 0f , 0f , 0f ) ; d . BodySetForce ( Body , 0 , 0 , 0 ) ; enableBodySoft ( ) ; } } } resetCollisionAccounting ( ) ; m_isSelected = m_taintselected ; }
Change prim in response to a selection taint.
Change prim in response to a selection taint .
// We do the body disable soft twice because 'in theory' a collision could have happened // in between the disabling and the collision properties setting // which would wake the physical body up from a soft disabling and potentially cause it to fall // through the ground. // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select // just one part of the assembly, the rest of the assembly is non-selected and still simulating, // so that causes the selected part to wake up and continue moving. // even if you select all parts of a jointed assembly, it is not guaranteed that the entire // assembly will stop simulating during the selection, because of the lack of atomicity // of select operations (their processing could be interrupted by a thread switch, causing // simulation to continue before all of the selected object notifications trickle down to // the physics engine). // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are // selected and disabled. then, due to a thread switch, the selection processing is // interrupted and the physics engine continues to simulate, so the last 50 items, whose // selection was not yet processed, continues to simulate. this wakes up ALL of the  // first 50 again. then the last 50 are disabled. then the first 50, which were just woken // up, start simulating again, which in turn wakes up the last 50.