diff options
author | Justin Clark-Casey (justincc) | 2011-07-08 19:43:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-08 19:43:22 +0100 |
commit | b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7 (patch) | |
tree | 78a97c7866fbc99f7381be505a86c92b0e0ff0bc /OpenSim/Region | |
parent | minor: code tidy up - remove a couple of Console.WriteLine() accidentally add... (diff) | |
download | opensim-SC_OLD-b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7.zip opensim-SC_OLD-b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7.tar.gz opensim-SC_OLD-b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7.tar.bz2 opensim-SC_OLD-b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7.tar.xz |
Fix interpretation of physics mesh proxies from mesh data
As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some submesh blocks may just have the flag "NoGeometry" to signal that they provide no mesh data.
If a block contains this, ignore it for meshing purposes rather than suffer a ClassCastException
This fixes physics proxy meshing, so you can now walk through mesh doorways, properly stand on the trailer of mesh trucks, etc.
To get mesh physics proxy, the UseMeshiesPhysicsMesh must be true in a [Mesh] config section in OpenSim.ini (example in OpenSimDefaults.ini).
Convex hull physics not currently supported.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index be4ee41..38b9112 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -366,6 +366,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
366 | // physics_shape is an array of OSDMaps, one for each submesh | 366 | // physics_shape is an array of OSDMaps, one for each submesh |
367 | if (decodedMeshOsd is OSDArray) | 367 | if (decodedMeshOsd is OSDArray) |
368 | { | 368 | { |
369 | // Console.WriteLine("decodedMeshOsd for {0} - {1}", primName, Util.GetFormattedXml(decodedMeshOsd)); | ||
370 | |||
369 | decodedMeshOsdArray = (OSDArray)decodedMeshOsd; | 371 | decodedMeshOsdArray = (OSDArray)decodedMeshOsd; |
370 | foreach (OSD subMeshOsd in decodedMeshOsdArray) | 372 | foreach (OSD subMeshOsd in decodedMeshOsdArray) |
371 | { | 373 | { |
@@ -373,6 +375,14 @@ namespace OpenSim.Region.Physics.Meshing | |||
373 | { | 375 | { |
374 | OSDMap subMeshMap = (OSDMap)subMeshOsd; | 376 | OSDMap subMeshMap = (OSDMap)subMeshOsd; |
375 | 377 | ||
378 | // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); | ||
379 | |||
380 | // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level | ||
381 | // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no | ||
382 | // geometry for this submesh. | ||
383 | if (subMeshMap.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshMap["NoGeometry"])) | ||
384 | continue; | ||
385 | |||
376 | OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); | 386 | OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); |
377 | OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); | 387 | OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); |
378 | ushort faceIndexOffset = (ushort)coords.Count; | 388 | ushort faceIndexOffset = (ushort)coords.Count; |