aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorTeravus Ovares2008-12-14 06:34:05 +0000
committerTeravus Ovares2008-12-14 06:34:05 +0000
commit6f7a560c04de374bc8239a662e53a806c2e07b2b (patch)
tree682a947dbdd432f7b33d04bec4cc5e2a918f3756 /OpenSim/Region/Physics/OdePlugin
parentAdds the "Send Teleport" module (diff)
downloadopensim-SC_OLD-6f7a560c04de374bc8239a662e53a806c2e07b2b.zip
opensim-SC_OLD-6f7a560c04de374bc8239a662e53a806c2e07b2b.tar.gz
opensim-SC_OLD-6f7a560c04de374bc8239a662e53a806c2e07b2b.tar.bz2
opensim-SC_OLD-6f7a560c04de374bc8239a662e53a806c2e07b2b.tar.xz
* A Few physical prim + linkset fixes. Prevent some crashes
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs70
1 files changed, 51 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index bd28dda..eeef893 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -700,6 +700,17 @@ namespace OpenSim.Region.Physics.OdePlugin
700 700
701 701
702 d.BodyDestroy(Body); 702 d.BodyDestroy(Body);
703 lock (childrenPrim)
704 {
705 if (childrenPrim.Count > 0)
706 {
707 foreach (OdePrim prm in childrenPrim)
708 {
709 _parent_scene.remActivePrim(prm);
710 prm.Body = IntPtr.Zero;
711 }
712 }
713 }
703 Body = IntPtr.Zero; 714 Body = IntPtr.Zero;
704 } 715 }
705 } 716 }
@@ -971,6 +982,12 @@ namespace OpenSim.Region.Physics.OdePlugin
971 prm.m_collisionCategories |= CollisionCategories.Body; 982 prm.m_collisionCategories |= CollisionCategories.Body;
972 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); 983 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
973 984
985 if (prm.prim_geom == IntPtr.Zero)
986 {
987 m_log.Warn("[PHYSICS]: Unable to link one of the linkset elements. No geom yet");
988 continue;
989 }
990
974 d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); 991 d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
975 d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); 992 d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
976 993
@@ -1345,31 +1362,46 @@ namespace OpenSim.Region.Physics.OdePlugin
1345 { 1362 {
1346 if (m_isphysical) 1363 if (m_isphysical)
1347 { 1364 {
1348 // This is a fallback.. May no longer be necessary. 1365
1349 if (Body == IntPtr.Zero) 1366 if (!m_disabled && !m_taintremove && !childPrim)
1350 enableBody();
1351 //Prim auto disable after 20 frames,
1352 //if you move it, re-enable the prim manually.
1353 if (_parent != null)
1354 { 1367 {
1355 if (m_linkJoint != IntPtr.Zero) 1368 if (Body == IntPtr.Zero)
1369 enableBody();
1370 //Prim auto disable after 20 frames,
1371 //if you move it, re-enable the prim manually.
1372 if (_parent != null)
1356 { 1373 {
1357 d.JointDestroy(m_linkJoint); 1374 if (m_linkJoint != IntPtr.Zero)
1358 m_linkJoint = IntPtr.Zero; 1375 {
1376 d.JointDestroy(m_linkJoint);
1377 m_linkJoint = IntPtr.Zero;
1378 }
1359 } 1379 }
1360 } 1380 if (Body != IntPtr.Zero)
1361 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
1362 if (_parent != null)
1363 {
1364 OdePrim odParent = (OdePrim)_parent;
1365 if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0 && Body != odParent.Body)
1366 { 1381 {
1367 m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); 1382 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
1368 d.JointAttach(m_linkJoint, Body, odParent.Body); 1383
1369 d.JointSetFixed(m_linkJoint); 1384 if (_parent != null)
1385 {
1386 OdePrim odParent = (OdePrim)_parent;
1387 if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0 && Body != odParent.Body)
1388 {
1389 m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup);
1390 d.JointAttach(m_linkJoint, Body, odParent.Body);
1391 d.JointSetFixed(m_linkJoint);
1392 }
1393 }
1394 d.BodyEnable(Body);
1395 }
1396 else
1397 {
1398 m_log.Warn("[PHYSICS]: Body Still null after enableBody(). This is a crash scenario.");
1370 } 1399 }
1371 } 1400 }
1372 d.BodyEnable(Body); 1401 //else
1402 // {
1403 //m_log.Debug("[BUG]: race!");
1404 //}
1373 } 1405 }
1374 else 1406 else
1375 { 1407 {