Fix physics proxy regeneration when a mesh with more than one submesh is resized

Addresses http://opensimulator.org/mantis/view.php?id=5584
bulletsim
Justin Clark-Casey (justincc) 2011-07-16 01:36:27 +01:00
parent 7247ca1644
commit 18652eb87e
4 changed files with 25 additions and 2 deletions

View File

@ -2662,13 +2662,18 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID); SceneObjectPart part = GetChildPart(localID);
if (part != null) if (part != null)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, part.Scale, scale);
part.IgnoreUndoUpdate = true; part.IgnoreUndoUpdate = true;
if (scale.X > m_scene.m_maxNonphys) if (scale.X > m_scene.m_maxNonphys)
scale.X = m_scene.m_maxNonphys; scale.X = m_scene.m_maxNonphys;
if (scale.Y > m_scene.m_maxNonphys) if (scale.Y > m_scene.m_maxNonphys)
scale.Y = m_scene.m_maxNonphys; scale.Y = m_scene.m_maxNonphys;
if (scale.Z > m_scene.m_maxNonphys) if (scale.Z > m_scene.m_maxNonphys)
scale.Z = m_scene.m_maxNonphys; scale.Z = m_scene.m_maxNonphys;
if (part.PhysActor != null && part.PhysActor.IsPhysical) if (part.PhysActor != null && part.PhysActor.IsPhysical)
{ {
if (scale.X > m_scene.m_maxPhys) if (scale.X > m_scene.m_maxPhys)
@ -2780,7 +2785,14 @@ namespace OpenSim.Region.Framework.Scenes
newSize.Z *= z; newSize.Z *= z;
obPart.Resize(newSize); obPart.Resize(newSize);
obPart.UpdateOffSet(currentpos); obPart.UpdateOffSet(currentpos);
if (obPart.PhysActor != null)
{
obPart.PhysActor.Size = newSize;
m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor);
}
} }
obPart.IgnoreUndoUpdate = false; obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState(); obPart.StoreUndoState();
} }

View File

@ -2839,6 +2839,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="scale"></param> /// <param name="scale"></param>
public void Resize(Vector3 scale) public void Resize(Vector3 scale)
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
StoreUndoState(); StoreUndoState();
m_shape.Scale = scale; m_shape.Scale = scale;
@ -2976,6 +2978,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Sets sculpt and mesh data, and tells the physics engine to process the change.
/// </summary>
/// <param name="textureID">Texture id of the mesh. XXX: Redundant since this is also in AssetBase</param>
/// <param name="texture">The mesh itself.</param>
public void SculptTextureCallback(UUID textureID, AssetBase texture) public void SculptTextureCallback(UUID textureID, AssetBase texture)
{ {
if (m_shape.SculptEntry) if (m_shape.SculptEntry)
@ -4613,7 +4620,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks> /// </remarks>
public void CheckSculptAndLoad() public void CheckSculptAndLoad()
{ {
// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
if (ParentGroup.IsDeleted) if (ParentGroup.IsDeleted)
return; return;

View File

@ -303,6 +303,10 @@ namespace OpenSim.Region.Physics.Meshing
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod) private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{ {
// m_log.DebugFormat(
// "[MESH]: Creating physics proxy for {0}, shape {1}",
// primName, (OpenMetaverse.SculptType)primShape.SculptType);
PrimMesh primMesh; PrimMesh primMesh;
PrimMesher.SculptMesh sculptMesh; PrimMesher.SculptMesh sculptMesh;
@ -668,7 +672,6 @@ namespace OpenSim.Region.Physics.Meshing
// If this mesh has been created already, return it instead of creating another copy // If this mesh has been created already, return it instead of creating another copy
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
key = GetMeshKey(primShape, size, lod); key = GetMeshKey(primShape, size, lod);
if (m_uniqueMeshes.TryGetValue(key, out mesh)) if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh; return mesh;

View File

@ -2284,6 +2284,7 @@ Console.WriteLine("changeshape not need meshing");
if (value.IsFinite()) if (value.IsFinite())
{ {
_size = value; _size = value;
// m_log.DebugFormat("[PHYSICS]: Set size on {0} to {1}", Name, value);
} }
else else
{ {