diff options
author | teravus | 2012-10-03 18:30:44 -0400 |
---|---|---|
committer | teravus | 2012-10-03 18:30:44 -0400 |
commit | a2ab3b88de764112996b1e37d74c1e7b7355b1d8 (patch) | |
tree | 3f7420e54546f404b6d4d1187549af52dba45bc0 /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | Fix the use of the wrong index when locating the assets associated (diff) | |
download | opensim-SC-a2ab3b88de764112996b1e37d74c1e7b7355b1d8.zip opensim-SC-a2ab3b88de764112996b1e37d74c1e7b7355b1d8.tar.gz opensim-SC-a2ab3b88de764112996b1e37d74c1e7b7355b1d8.tar.bz2 opensim-SC-a2ab3b88de764112996b1e37d74c1e7b7355b1d8.tar.xz |
Soliciting for comments on smoothness of physics objects for this build.
This introduces expected contact point hints to the ODE Collider to better determine when to throttle updates as excessive. This /should/ smooth physics objects out again, however, I cannot know every configuration of OpenSimulator, so I'm requesting that testers please examine this change on their build.
Thanks!
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 1b47754..e7b3b2b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -63,6 +63,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
63 | 63 | ||
64 | private bool m_isphysical; | 64 | private bool m_isphysical; |
65 | 65 | ||
66 | public int ExpectedCollisionContacts { get { return m_expectedCollisionContacts; } } | ||
67 | private int m_expectedCollisionContacts = 0; | ||
68 | |||
66 | /// <summary> | 69 | /// <summary> |
67 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. | 70 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. |
68 | /// </summary> | 71 | /// </summary> |
@@ -150,7 +153,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
150 | 153 | ||
151 | private PrimitiveBaseShape _pbs; | 154 | private PrimitiveBaseShape _pbs; |
152 | private OdeScene _parent_scene; | 155 | private OdeScene _parent_scene; |
153 | 156 | ||
154 | /// <summary> | 157 | /// <summary> |
155 | /// The physics space which contains prim geometries | 158 | /// The physics space which contains prim geometries |
156 | /// </summary> | 159 | /// </summary> |
@@ -840,7 +843,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
840 | int vertexStride, triStride; | 843 | int vertexStride, triStride; |
841 | mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap | 844 | mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap |
842 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage | 845 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage |
843 | 846 | m_expectedCollisionContacts = indexCount; | |
844 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory | 847 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory |
845 | 848 | ||
846 | // We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at | 849 | // We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at |
@@ -1377,6 +1380,7 @@ Console.WriteLine("CreateGeom:"); | |||
1377 | { | 1380 | { |
1378 | //Console.WriteLine(" CreateGeom 1"); | 1381 | //Console.WriteLine(" CreateGeom 1"); |
1379 | SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2)); | 1382 | SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2)); |
1383 | m_expectedCollisionContacts = 3; | ||
1380 | } | 1384 | } |
1381 | catch (AccessViolationException) | 1385 | catch (AccessViolationException) |
1382 | { | 1386 | { |
@@ -1391,6 +1395,7 @@ Console.WriteLine("CreateGeom:"); | |||
1391 | { | 1395 | { |
1392 | //Console.WriteLine(" CreateGeom 2"); | 1396 | //Console.WriteLine(" CreateGeom 2"); |
1393 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); | 1397 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); |
1398 | m_expectedCollisionContacts = 4; | ||
1394 | } | 1399 | } |
1395 | catch (AccessViolationException) | 1400 | catch (AccessViolationException) |
1396 | { | 1401 | { |
@@ -1406,6 +1411,7 @@ Console.WriteLine("CreateGeom:"); | |||
1406 | { | 1411 | { |
1407 | //Console.WriteLine(" CreateGeom 3"); | 1412 | //Console.WriteLine(" CreateGeom 3"); |
1408 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); | 1413 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); |
1414 | m_expectedCollisionContacts = 4; | ||
1409 | } | 1415 | } |
1410 | catch (AccessViolationException) | 1416 | catch (AccessViolationException) |
1411 | { | 1417 | { |
@@ -1421,6 +1427,7 @@ Console.WriteLine("CreateGeom:"); | |||
1421 | { | 1427 | { |
1422 | //Console.WriteLine(" CreateGeom 4"); | 1428 | //Console.WriteLine(" CreateGeom 4"); |
1423 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); | 1429 | SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); |
1430 | m_expectedCollisionContacts = 4; | ||
1424 | } | 1431 | } |
1425 | catch (AccessViolationException) | 1432 | catch (AccessViolationException) |
1426 | { | 1433 | { |
@@ -1446,11 +1453,13 @@ Console.WriteLine("CreateGeom:"); | |||
1446 | _parent_scene.geom_name_map.Remove(prim_geom); | 1453 | _parent_scene.geom_name_map.Remove(prim_geom); |
1447 | _parent_scene.actor_name_map.Remove(prim_geom); | 1454 | _parent_scene.actor_name_map.Remove(prim_geom); |
1448 | d.GeomDestroy(prim_geom); | 1455 | d.GeomDestroy(prim_geom); |
1456 | m_expectedCollisionContacts = 0; | ||
1449 | prim_geom = IntPtr.Zero; | 1457 | prim_geom = IntPtr.Zero; |
1450 | } | 1458 | } |
1451 | catch (System.AccessViolationException) | 1459 | catch (System.AccessViolationException) |
1452 | { | 1460 | { |
1453 | prim_geom = IntPtr.Zero; | 1461 | prim_geom = IntPtr.Zero; |
1462 | m_expectedCollisionContacts = 0; | ||
1454 | m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name); | 1463 | m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name); |
1455 | 1464 | ||
1456 | return false; | 1465 | return false; |