aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs4
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs1
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs355
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs15
4 files changed, 297 insertions, 78 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 25aa4dc..1a0c2a7 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -72,11 +72,13 @@ namespace OpenSim.Region.Physics.Manager
72 { 72 {
73 public float mu; 73 public float mu;
74 public float bounce; 74 public float bounce;
75 public bool softcolide;
75 76
76 public ContactData(float _mu, float _bounce) 77 public ContactData(float _mu, float _bounce, bool _softcolide)
77 { 78 {
78 mu = _mu; 79 mu = _mu;
79 bounce = _bounce; 80 bounce = _bounce;
81 softcolide = _softcolide;
80 } 82 }
81 } 83 }
82 /// <summary> 84 /// <summary>
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index 94cadb2..9a22331 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -195,6 +195,7 @@ namespace OpenSim.Region.Physics.OdePlugin
195 { 195 {
196 cdata.mu = mu; 196 cdata.mu = mu;
197 cdata.bounce = bounce; 197 cdata.bounce = bounce;
198 cdata.softcolide = false;
198 } 199 }
199 200
200 public override bool Building { get; set; } 201 public override bool Building { get; set; }
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index db07565..b105f77 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -114,6 +114,9 @@ namespace OpenSim.Region.Physics.OdePlugin
114// private bool m_collidesLand = true; 114// private bool m_collidesLand = true;
115 private bool m_collidesWater; 115 private bool m_collidesWater;
116 public bool m_returnCollisions; 116 public bool m_returnCollisions;
117 private bool m_softcolide;
118
119 private bool m_NoColide; // for now only for internal use for bad meshs
117 120
118 // Default we're a Geometry 121 // Default we're a Geometry
119 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); 122 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
@@ -224,6 +227,9 @@ namespace OpenSim.Region.Physics.OdePlugin
224 cdata.mu = mu; 227 cdata.mu = mu;
225 cdata.bounce = bounce; 228 cdata.bounce = bounce;
226 229
230 // cdata.softcolide = m_softcolide;
231 cdata.softcolide = false;
232
227 if (m_isphysical) 233 if (m_isphysical)
228 { 234 {
229 ODEDynamics veh; 235 ODEDynamics veh;
@@ -303,7 +309,10 @@ namespace OpenSim.Region.Physics.OdePlugin
303 } 309 }
304 310
305 if (m_colliderfilter == 0) 311 if (m_colliderfilter == 0)
312 {
313 m_softcolide = false;
306 m_iscolliding = false; 314 m_iscolliding = false;
315 }
307 else 316 else
308 m_iscolliding = true; 317 m_iscolliding = true;
309 } 318 }
@@ -859,7 +868,6 @@ namespace OpenSim.Region.Physics.OdePlugin
859 868
860 _size = size; 869 _size = size;
861 870
862
863 if (!QuaternionIsFinite(rotation)) 871 if (!QuaternionIsFinite(rotation))
864 { 872 {
865 rotation = Quaternion.Identity; 873 rotation = Quaternion.Identity;
@@ -890,6 +898,8 @@ namespace OpenSim.Region.Physics.OdePlugin
890 898
891 m_iscolliding = false; 899 m_iscolliding = false;
892 m_colliderfilter = 0; 900 m_colliderfilter = 0;
901 m_softcolide = true;
902 m_NoColide = false;
893 903
894 hasOOBoffsetFromMesh = false; 904 hasOOBoffsetFromMesh = false;
895 _triMeshData = IntPtr.Zero; 905 _triMeshData = IntPtr.Zero;
@@ -1037,34 +1047,42 @@ namespace OpenSim.Region.Physics.OdePlugin
1037 1047
1038 if (vertexCount == 0 || indexCount == 0) 1048 if (vertexCount == 0 || indexCount == 0)
1039 { 1049 {
1040 m_log.WarnFormat("[PHYSICS]: Got invalid mesh on prim {0} at <{1},{2},{3}>. It can be a sculp with alpha channel in map. Replacing it by a small box.", Name, _position.X, _position.Y, _position.Z); 1050 m_log.WarnFormat("[PHYSICS]: Got invalid mesh on prim {0} at <{1},{2},{3}>. mesh UUID {4}",
1041 _size.X = 0.01f; 1051 Name, _position.X, _position.Y, _position.Z, _pbs.SculptTexture.ToString());
1042 _size.Y = 0.01f; 1052 mesh.releaseSourceMeshData();
1043 _size.Z = 0.01f;
1044 return false; 1053 return false;
1045 } 1054 }
1046 1055
1047 primOOBoffset = mesh.GetCentroid(); 1056 primOOBoffset = mesh.GetCentroid();
1048 hasOOBoffsetFromMesh = true; 1057 hasOOBoffsetFromMesh = true;
1049 1058
1050 _triMeshData = d.GeomTriMeshDataCreate();
1051
1052 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1053 d.GeomTriMeshDataPreprocess(_triMeshData);
1054
1055 mesh.releaseSourceMeshData(); 1059 mesh.releaseSourceMeshData();
1056 1060
1057 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1061 IntPtr geo = IntPtr.Zero;
1062
1058 try 1063 try
1059 { 1064 {
1060 SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null)); 1065 _triMeshData = d.GeomTriMeshDataCreate();
1066
1067 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1068 d.GeomTriMeshDataPreprocess(_triMeshData);
1069
1070 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1071 geo = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null);
1061 } 1072 }
1062 1073
1063 catch (Exception e) 1074 catch (Exception e)
1064 { 1075 {
1065 m_log.ErrorFormat("[PHYSICS]: SetGeom Mesh failed for {0} exception: {1}", Name, e); 1076 m_log.ErrorFormat("[PHYSICS]: SetGeom Mesh failed for {0} exception: {1}", Name, e);
1077 if (_triMeshData != IntPtr.Zero)
1078 {
1079 d.GeomTriMeshDataDestroy(_triMeshData);
1080 _triMeshData = IntPtr.Zero;
1081 }
1066 return false; 1082 return false;
1067 } 1083 }
1084
1085 SetGeom(geo);
1068 return true; 1086 return true;
1069 } 1087 }
1070 1088
@@ -1074,25 +1092,30 @@ namespace OpenSim.Region.Physics.OdePlugin
1074 //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); 1092 //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
1075 if (prim_geom != IntPtr.Zero) 1093 if (prim_geom != IntPtr.Zero)
1076 { 1094 {
1077 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); 1095 if (m_NoColide)
1078 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 1096 {
1097 d.GeomSetCategoryBits(prim_geom, 0);
1098 if (m_isphysical)
1099 {
1100 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1101 }
1102 else
1103 {
1104 d.GeomSetCollideBits(prim_geom, 0);
1105 d.GeomDisable(prim_geom);
1106 }
1107 }
1108 else
1109 {
1110 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1111 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1112 }
1079 1113
1080 CalcPrimBodyData(); 1114 CalcPrimBodyData();
1081 1115
1082 _parent_scene.geom_name_map[prim_geom] = Name; 1116 _parent_scene.geom_name_map[prim_geom] = Name;
1083 _parent_scene.actor_name_map[prim_geom] = this; 1117 _parent_scene.actor_name_map[prim_geom] = this;
1084 1118
1085 /*
1086 if (childPrim)
1087 {
1088 if (_parent != null && _parent is OdePrim)
1089 {
1090 OdePrim parent = (OdePrim)_parent;
1091 //Console.WriteLine("SetGeom calls ChildSetGeom");
1092 parent.ChildSetGeom(this);
1093 }
1094 }
1095 */
1096 } 1119 }
1097 else 1120 else
1098 m_log.Warn("Setting bad Geom"); 1121 m_log.Warn("Setting bad Geom");
@@ -1114,10 +1137,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1114 1137
1115 bool haveMesh = false; 1138 bool haveMesh = false;
1116 hasOOBoffsetFromMesh = false; 1139 hasOOBoffsetFromMesh = false;
1140 m_NoColide = false;
1117 1141
1118 if (_parent_scene.needsMeshing(_pbs)) 1142 if (_parent_scene.needsMeshing(_pbs))
1119 { 1143 {
1120 haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims 1144 haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims
1145 if (!haveMesh)
1146 m_NoColide = true;
1121 } 1147 }
1122 1148
1123 if (!haveMesh) 1149 if (!haveMesh)
@@ -1209,12 +1235,46 @@ namespace OpenSim.Region.Physics.OdePlugin
1209 { 1235 {
1210 if (!childPrim && !m_isSelected) 1236 if (!childPrim && !m_isSelected)
1211 { 1237 {
1212 if (m_isphysical && Body != IntPtr.Zero && prim_geom != IntPtr.Zero) 1238 if (m_isphysical && Body != IntPtr.Zero)
1213 { 1239 {
1214 d.GeomEnable(prim_geom); 1240 m_collisionCategories |= CollisionCategories.Body;
1241 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1242
1215 foreach (OdePrim prm in childrenPrim) 1243 foreach (OdePrim prm in childrenPrim)
1216 d.GeomEnable(prm.prim_geom); 1244 {
1245 prm.m_collisionCategories = m_collisionCategories;
1246 prm.m_collisionFlags = m_collisionFlags;
1247
1248 if (prm.prim_geom != IntPtr.Zero)
1249 {
1250 if (prm.m_NoColide)
1251 {
1252 d.GeomSetCategoryBits(prm.prim_geom, 0);
1253 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
1254 }
1255 else
1256 {
1257 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
1258 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
1259 }
1260 d.GeomEnable(prm.prim_geom);
1261 }
1262 }
1217 1263
1264 if (prim_geom != IntPtr.Zero)
1265 {
1266 if (m_NoColide)
1267 {
1268 d.GeomSetCategoryBits(prim_geom, 0);
1269 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1270 }
1271 else
1272 {
1273 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1274 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1275 }
1276 d.GeomEnable(prim_geom);
1277 }
1218 d.BodyEnable(Body); 1278 d.BodyEnable(Body);
1219 } 1279 }
1220 } 1280 }
@@ -1227,11 +1287,47 @@ namespace OpenSim.Region.Physics.OdePlugin
1227 m_disabled = true; 1287 m_disabled = true;
1228 if (!childPrim) 1288 if (!childPrim)
1229 { 1289 {
1230 if (m_isphysical && Body != IntPtr.Zero && prim_geom != IntPtr.Zero) 1290 if (m_isphysical && Body != IntPtr.Zero)
1231 { 1291 {
1232 d.GeomDisable(prim_geom); 1292 m_collisionCategories &= ~CollisionCategories.Body;
1293 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
1294
1233 foreach (OdePrim prm in childrenPrim) 1295 foreach (OdePrim prm in childrenPrim)
1234 d.GeomDisable(prm.prim_geom); 1296 {
1297 prm.m_collisionCategories = m_collisionCategories;
1298 prm.m_collisionFlags = m_collisionFlags;
1299
1300 if (prm.prim_geom != IntPtr.Zero)
1301 {
1302 if (prm.m_NoColide)
1303 {
1304 d.GeomSetCategoryBits(prm.prim_geom, 0);
1305 d.GeomSetCollideBits(prm.prim_geom, 0);
1306 }
1307 else
1308 {
1309 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
1310 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
1311 }
1312 d.GeomDisable(prm.prim_geom);
1313 }
1314 }
1315
1316 if (prim_geom != IntPtr.Zero)
1317 {
1318 if (m_NoColide)
1319 {
1320 d.GeomSetCategoryBits(prim_geom, 0);
1321 d.GeomSetCollideBits(prim_geom, 0);
1322 }
1323 else
1324 {
1325 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1326 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1327 }
1328 d.GeomDisable(prim_geom);
1329 }
1330
1235 d.BodyDisable(Body); 1331 d.BodyDisable(Body);
1236 } 1332 }
1237 } 1333 }
@@ -1310,8 +1406,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1310 continue; 1406 continue;
1311 } 1407 }
1312 1408
1313
1314
1315 DMassCopy(ref prm.primdMass, ref tmpdmass); 1409 DMassCopy(ref prm.primdMass, ref tmpdmass);
1316 1410
1317 // apply prim current rotation to inertia 1411 // apply prim current rotation to inertia
@@ -1373,14 +1467,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1373 // d.BodySetAngularDampingThreshold(Body, 0.001f); 1467 // d.BodySetAngularDampingThreshold(Body, 0.001f);
1374 d.BodySetDamping(Body, .002f, .002f); 1468 d.BodySetDamping(Body, .002f, .002f);
1375 1469
1376 m_collisionCategories |= CollisionCategories.Body;
1377 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1378 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1379 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1380 m_collisionscore = 0;
1381 1470
1382// if (m_targetSpace != _parent_scene.ActiveSpace)
1383 {
1384 if (m_targetSpace != IntPtr.Zero) 1471 if (m_targetSpace != IntPtr.Zero)
1385 { 1472 {
1386 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1473 _parent_scene.waitForSpaceUnlock(m_targetSpace);
@@ -1388,10 +1475,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1388 d.SpaceRemove(m_targetSpace, prim_geom); 1475 d.SpaceRemove(m_targetSpace, prim_geom);
1389 } 1476 }
1390 1477
1391// m_targetSpace = _parent_scene.ActiveSpace;
1392// d.SpaceAdd(m_targetSpace, prim_geom);
1393 }
1394
1395 1478
1396 if (childrenPrim.Count == 0) 1479 if (childrenPrim.Count == 0)
1397 { 1480 {
@@ -1419,12 +1502,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1419 Vector3 ppos = prm._position; 1502 Vector3 ppos = prm._position;
1420 d.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position 1503 d.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position
1421 1504
1422 prm.m_collisionCategories |= CollisionCategories.Body;
1423 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1424 d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
1425 d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
1426 prm.m_collisionscore = 0;
1427
1428 if (prm.m_targetSpace != m_targetSpace) 1505 if (prm.m_targetSpace != m_targetSpace)
1429 { 1506 {
1430 if (prm.m_targetSpace != IntPtr.Zero) 1507 if (prm.m_targetSpace != IntPtr.Zero)
@@ -1438,9 +1515,32 @@ namespace OpenSim.Region.Physics.OdePlugin
1438 } 1515 }
1439 1516
1440 if (m_isSelected || m_disabled) 1517 if (m_isSelected || m_disabled)
1518 {
1519 prm.m_collisionCategories &= ~CollisionCategories.Body;
1520 prm.m_collisionFlags &= ~(CollisionCategories.Land | CollisionCategories.Wind);
1441 d.GeomDisable(prm.prim_geom); 1521 d.GeomDisable(prm.prim_geom);
1522 }
1523 else
1524 {
1525 prm.m_collisionCategories |= CollisionCategories.Body;
1526 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1527 }
1528
1529 if (prm.m_NoColide)
1530 {
1531 d.GeomSetCategoryBits(prm.prim_geom, 0);
1532 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
1533 }
1534 else
1535 {
1536 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
1537 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
1538 }
1539 prm.m_collisionscore = 0;
1540
1541 if(!m_disabled)
1542 prm.m_disabled = false;
1442 1543
1443 prm.m_disabled = false;
1444 _parent_scene.addActivePrim(prm); 1544 _parent_scene.addActivePrim(prm);
1445 } 1545 }
1446 } 1546 }
@@ -1453,15 +1553,35 @@ namespace OpenSim.Region.Physics.OdePlugin
1453 1553
1454 if (m_isSelected || m_disabled) 1554 if (m_isSelected || m_disabled)
1455 { 1555 {
1556 m_collisionCategories &= ~CollisionCategories.Body;
1557 m_collisionFlags &= ~(CollisionCategories.Land | CollisionCategories.Wind);
1558
1456 d.GeomDisable(prim_geom); 1559 d.GeomDisable(prim_geom);
1457 d.BodyDisable(Body); 1560 d.BodyDisable(Body);
1458 } 1561 }
1459 else 1562 else
1460 { 1563 {
1564 m_collisionCategories |= CollisionCategories.Body;
1565 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1566
1461 d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); 1567 d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
1462 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); 1568 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
1463 } 1569 }
1464 1570
1571 if (m_NoColide)
1572 {
1573 d.GeomSetCategoryBits(prim_geom, 0);
1574 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1575 }
1576 else
1577 {
1578 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1579 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1580 }
1581
1582 m_collisionscore = 0;
1583
1584 m_softcolide = true;
1465 _parent_scene.addActivePrim(this); 1585 _parent_scene.addActivePrim(this);
1466 _parent_scene.addActiveGroups(this); 1586 _parent_scene.addActiveGroups(this);
1467 } 1587 }
@@ -1475,8 +1595,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1475 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); 1595 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
1476 if (prim_geom != IntPtr.Zero) 1596 if (prim_geom != IntPtr.Zero)
1477 { 1597 {
1478 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); 1598 if (m_NoColide)
1479 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 1599 {
1600 d.GeomSetCategoryBits(prim_geom, 0);
1601 d.GeomSetCollideBits(prim_geom, 0);
1602 }
1603 else
1604 {
1605 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1606 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1607 }
1480 UpdateDataFromGeom(); 1608 UpdateDataFromGeom();
1481 d.GeomSetBody(prim_geom, IntPtr.Zero); 1609 d.GeomSetBody(prim_geom, IntPtr.Zero);
1482 SetInStaticSpace(this); 1610 SetInStaticSpace(this);
@@ -1489,12 +1617,20 @@ namespace OpenSim.Region.Physics.OdePlugin
1489 foreach (OdePrim prm in childrenPrim) 1617 foreach (OdePrim prm in childrenPrim)
1490 { 1618 {
1491 _parent_scene.remActivePrim(prm); 1619 _parent_scene.remActivePrim(prm);
1492 prm.m_collisionCategories &= ~CollisionCategories.Body; 1620 prm.m_collisionCategories = m_collisionCategories;
1493 prm.m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); 1621 prm.m_collisionFlags = m_collisionFlags;
1494 if (prm.prim_geom != IntPtr.Zero) 1622 if (prm.prim_geom != IntPtr.Zero)
1495 { 1623 {
1496 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories); 1624 if (prm.m_NoColide)
1497 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags); 1625 {
1626 d.GeomSetCategoryBits(prm.prim_geom, 0);
1627 d.GeomSetCollideBits(prm.prim_geom, 0);
1628 }
1629 else
1630 {
1631 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
1632 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
1633 }
1498 prm.UpdateDataFromGeom(); 1634 prm.UpdateDataFromGeom();
1499 SetInStaticSpace(prm); 1635 SetInStaticSpace(prm);
1500 } 1636 }
@@ -2044,23 +2180,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2044 myrot.Z = _orientation.Z; 2180 myrot.Z = _orientation.Z;
2045 myrot.W = _orientation.W; 2181 myrot.W = _orientation.W;
2046 d.GeomSetQuaternion(prim_geom, ref myrot); 2182 d.GeomSetQuaternion(prim_geom, ref myrot);
2047 // _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; 2183
2048 if (!m_isphysical) 2184 if (!m_isphysical)
2049 SetInStaticSpace(this); 2185 SetInStaticSpace(this);
2050 } 2186 }
2051 2187
2052 if (m_isphysical && Body == IntPtr.Zero) 2188 if (m_isphysical && Body == IntPtr.Zero)
2053 { 2189 {
2054 /*
2055 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2056 {
2057 changeShape(_pbs);
2058 }
2059 else
2060 {
2061 */
2062 MakeBody(); 2190 MakeBody();
2063 // }
2064 } 2191 }
2065 } 2192 }
2066 2193
@@ -2169,17 +2296,52 @@ namespace OpenSim.Region.Physics.OdePlugin
2169 if (!childPrim && Body != IntPtr.Zero) 2296 if (!childPrim && Body != IntPtr.Zero)
2170 d.BodyDisable(Body); 2297 d.BodyDisable(Body);
2171 2298
2172 if (m_delaySelect) 2299 if (m_delaySelect || m_isphysical)
2173 { 2300 {
2301 m_collisionCategories = CollisionCategories.Selected;
2302 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
2303
2174 if (!childPrim) 2304 if (!childPrim)
2175 { 2305 {
2176 foreach (OdePrim prm in childrenPrim) 2306 foreach (OdePrim prm in childrenPrim)
2177 { 2307 {
2178 d.GeomDisable(prm.prim_geom); 2308 prm.m_collisionCategories = m_collisionCategories;
2309 prm.m_collisionFlags = m_collisionFlags;
2310
2311 if (prm.prim_geom != null)
2312 {
2313
2314 if (prm.m_NoColide)
2315 {
2316 d.GeomSetCategoryBits(prm.prim_geom, 0);
2317 d.GeomSetCollideBits(prm.prim_geom, 0);
2318 }
2319 else
2320 {
2321 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
2322 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
2323 }
2324 d.GeomDisable(prm.prim_geom);
2325 }
2179 prm.m_delaySelect = false; 2326 prm.m_delaySelect = false;
2180 } 2327 }
2181 } 2328 }
2182 d.GeomDisable(prim_geom); 2329
2330 if (prim_geom != null)
2331 {
2332 if (m_NoColide)
2333 {
2334 d.GeomSetCategoryBits(prim_geom, 0);
2335 d.GeomSetCollideBits(prim_geom, 0);
2336 }
2337 else
2338 {
2339 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
2340 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2341 }
2342 d.GeomDisable(prim_geom);
2343 }
2344
2183 m_delaySelect = false; 2345 m_delaySelect = false;
2184 } 2346 }
2185 else 2347 else
@@ -2192,19 +2354,64 @@ namespace OpenSim.Region.Physics.OdePlugin
2192 if (!childPrim && Body != IntPtr.Zero && !m_disabled) 2354 if (!childPrim && Body != IntPtr.Zero && !m_disabled)
2193 d.BodyEnable(Body); 2355 d.BodyEnable(Body);
2194 2356
2357 m_collisionCategories = CollisionCategories.Geom;
2358 if (m_isphysical)
2359 m_collisionCategories |= CollisionCategories.Body;
2360
2361 m_collisionFlags = m_default_collisionFlags | CollisionCategories.Land;
2362
2363 if (m_collidesWater)
2364 m_collisionFlags |= CollisionCategories.Water;
2365
2195 if (!childPrim) 2366 if (!childPrim)
2196 { 2367 {
2197 foreach (OdePrim prm in childrenPrim) 2368 foreach (OdePrim prm in childrenPrim)
2198 { 2369 {
2199 if(!prm.m_disabled) 2370 prm.m_collisionCategories = m_collisionCategories;
2371 prm.m_collisionFlags = m_collisionFlags;
2372
2373 if (!prm.m_disabled && prm.prim_geom != IntPtr.Zero)
2374 {
2375 if (prm.m_NoColide)
2376 {
2377 d.GeomSetCategoryBits(prm.prim_geom, 0);
2378 if (m_isphysical)
2379 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
2380 else
2381 d.GeomSetCollideBits(prm.prim_geom, 0);
2382 }
2383 else
2384 {
2385 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
2386 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
2387 }
2200 d.GeomEnable(prm.prim_geom); 2388 d.GeomEnable(prm.prim_geom);
2389 }
2201 prm.m_delaySelect = false; 2390 prm.m_delaySelect = false;
2391 prm.m_softcolide = true;
2202 } 2392 }
2203 } 2393 }
2204 if(!m_disabled) 2394
2395 if (!m_disabled && prim_geom != IntPtr.Zero)
2396 {
2397 if (m_NoColide)
2398 {
2399 d.GeomSetCategoryBits(prim_geom, 0);
2400 if (m_isphysical)
2401 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
2402 else
2403 d.GeomSetCollideBits(prim_geom, 0);
2404 }
2405 else
2406 {
2407 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
2408 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2409 }
2205 d.GeomEnable(prim_geom); 2410 d.GeomEnable(prim_geom);
2411 }
2206 2412
2207 m_delaySelect = false; 2413 m_delaySelect = false;
2414 m_softcolide = true;
2208 } 2415 }
2209 2416
2210 resetCollisionAccounting(); 2417 resetCollisionAccounting();
@@ -2250,6 +2457,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2250 if (givefakepos < 0) 2457 if (givefakepos < 0)
2251 givefakepos = 0; 2458 givefakepos = 0;
2252 // changeSelectedStatus(); 2459 // changeSelectedStatus();
2460 m_softcolide = true;
2253 resetCollisionAccounting(); 2461 resetCollisionAccounting();
2254 } 2462 }
2255 2463
@@ -2302,6 +2510,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2302 givefakeori--; 2510 givefakeori--;
2303 if (givefakeori < 0) 2511 if (givefakeori < 0)
2304 givefakeori = 0; 2512 givefakeori = 0;
2513 m_softcolide = true;
2305 resetCollisionAccounting(); 2514 resetCollisionAccounting();
2306 } 2515 }
2307 2516
@@ -2372,6 +2581,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2372 if (givefakeori < 0) 2581 if (givefakeori < 0)
2373 givefakeori = 0; 2582 givefakeori = 0;
2374 2583
2584 m_softcolide = true;
2375 resetCollisionAccounting(); 2585 resetCollisionAccounting();
2376 } 2586 }
2377 2587
@@ -2488,6 +2698,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2488 else 2698 else
2489 MakeBody(); 2699 MakeBody();
2490 2700
2701 m_softcolide = true;
2491 resetCollisionAccounting(); 2702 resetCollisionAccounting();
2492 } 2703 }
2493 2704
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 884a5a7..14516f9 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -693,8 +693,8 @@ namespace OpenSim.Region.Physics.OdePlugin
693 // big messy collision analises 693 // big messy collision analises
694 float mu = 0; 694 float mu = 0;
695 float bounce = 0; 695 float bounce = 0;
696 ContactData contactdata1 = new ContactData(0, 0); 696 ContactData contactdata1 = new ContactData(0, 0, false);
697 ContactData contactdata2 = new ContactData(0, 0); 697 ContactData contactdata2 = new ContactData(0, 0, false);
698 bool erpSoft = false; 698 bool erpSoft = false;
699 699
700 String name = null; 700 String name = null;
@@ -718,6 +718,7 @@ namespace OpenSim.Region.Physics.OdePlugin
718 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 718 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
719 mu *= frictionMovementMult; 719 mu *= frictionMovementMult;
720 720
721 erpSoft = contactdata1.softcolide | contactdata2.softcolide;
721 p1.CollidingObj = true; 722 p1.CollidingObj = true;
722 p2.CollidingObj = true; 723 p2.CollidingObj = true;
723 break; 724 break;
@@ -732,6 +733,9 @@ namespace OpenSim.Region.Physics.OdePlugin
732 mu *= frictionMovementMult; 733 mu *= frictionMovementMult;
733 if (p2.Velocity.LengthSquared() > 0.0f) 734 if (p2.Velocity.LengthSquared() > 0.0f)
734 p2.CollidingObj = true; 735 p2.CollidingObj = true;
736
737 erpSoft = contactdata1.softcolide | contactdata2.softcolide;
738
735 dop1foot = true; 739 dop1foot = true;
736 break; 740 break;
737 default: 741 default:
@@ -753,6 +757,7 @@ namespace OpenSim.Region.Physics.OdePlugin
753 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 757 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
754 mu *= frictionMovementMult; 758 mu *= frictionMovementMult;
755 759
760 erpSoft = contactdata1.softcolide | contactdata2.softcolide;
756 dop2foot = true; 761 dop2foot = true;
757 if (p1.Velocity.LengthSquared() > 0.0f) 762 if (p1.Velocity.LengthSquared() > 0.0f)
758 p1.CollidingObj = true; 763 p1.CollidingObj = true;
@@ -766,7 +771,7 @@ namespace OpenSim.Region.Physics.OdePlugin
766 p1.getContactData(ref contactdata1); 771 p1.getContactData(ref contactdata1);
767 p2.getContactData(ref contactdata2); 772 p2.getContactData(ref contactdata2);
768 bounce = contactdata1.bounce * contactdata2.bounce; 773 bounce = contactdata1.bounce * contactdata2.bounce;
769 erpSoft = true; 774 erpSoft = contactdata1.softcolide | contactdata2.softcolide;
770 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); 775 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
771 776
772 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f)) 777 if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
@@ -778,12 +783,12 @@ namespace OpenSim.Region.Physics.OdePlugin
778 { 783 {
779 if (name == "Terrain") 784 if (name == "Terrain")
780 { 785 {
781 erpSoft = true;
782 p1.getContactData(ref contactdata1); 786 p1.getContactData(ref contactdata1);
783 bounce = contactdata1.bounce * TerrainBounce; 787 bounce = contactdata1.bounce * TerrainBounce;
784 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); 788 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
785 if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) 789 if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
786 mu *= frictionMovementMult; 790 mu *= frictionMovementMult;
791 erpSoft = contactdata1.softcolide;
787 p1.CollidingGround = true; 792 p1.CollidingGround = true;
788 } 793 }
789 else if (name == "Water") 794 else if (name == "Water")
@@ -804,11 +809,11 @@ namespace OpenSim.Region.Physics.OdePlugin
804 { 809 {
805 if (p2.PhysicsActorType == (int)ActorTypes.Prim) 810 if (p2.PhysicsActorType == (int)ActorTypes.Prim)
806 { 811 {
807 erpSoft = true;
808 p2.CollidingGround = true; 812 p2.CollidingGround = true;
809 p2.getContactData(ref contactdata2); 813 p2.getContactData(ref contactdata2);
810 bounce = contactdata2.bounce * TerrainBounce; 814 bounce = contactdata2.bounce * TerrainBounce;
811 mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction); 815 mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction);
816 erpSoft = contactdata2.softcolide;
812 817
813 if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) 818 if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
814 mu *= frictionMovementMult; 819 mu *= frictionMovementMult;