aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs171
1 files changed, 142 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 63b29ba..5d8f03c 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -65,8 +65,9 @@ namespace OpenSim.Region.Physics.OdePlugin
65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 66
67 private bool m_isphysical; 67 private bool m_isphysical;
68 private bool m_isPhantom;
69 private bool m_fakeisphysical; 68 private bool m_fakeisphysical;
69 private bool m_isphantom;
70 private bool m_fakeisphantom;
70 71
71 protected bool m_building; 72 protected bool m_building;
72 private Quaternion m_lastorientation = new Quaternion(); 73 private Quaternion m_lastorientation = new Quaternion();
@@ -212,6 +213,19 @@ namespace OpenSim.Region.Physics.OdePlugin
212 } 213 }
213 } 214 }
214 215
216 public override bool Phantom // this is not reliable for internal use
217 {
218 get { return m_fakeisphantom; }
219 set
220 {
221 m_fakeisphantom = value; // we show imediatly to outside that we changed physical
222 // and also to stop imediatly some updates
223 // but real change will only happen in taintprocessing
224
225 AddChange(changes.Phantom, value);
226 }
227 }
228
215 public override bool Building // this is not reliable for internal use 229 public override bool Building // this is not reliable for internal use
216 { 230 {
217 get { return m_building; } 231 get { return m_building; }
@@ -910,7 +924,8 @@ namespace OpenSim.Region.Physics.OdePlugin
910 m_isSelected = false; 924 m_isSelected = false;
911 m_delaySelect = false; 925 m_delaySelect = false;
912 926
913 m_isPhantom = pisPhantom; 927 m_isphantom = pisPhantom;
928 m_fakeisphantom = pisPhantom;
914 929
915 mu = parent_scene.m_materialContactsData[(int)Material.Wood].mu; 930 mu = parent_scene.m_materialContactsData[(int)Material.Wood].mu;
916 bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; 931 bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce;
@@ -1241,8 +1256,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1241 { 1256 {
1242 if (m_isphysical && Body != IntPtr.Zero) 1257 if (m_isphysical && Body != IntPtr.Zero)
1243 { 1258 {
1244 m_collisionCategories |= CollisionCategories.Body; 1259 if (m_isphantom && !m_isVolumeDetect)
1245 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); 1260 {
1261 m_collisionCategories = 0;
1262 m_collisionFlags = CollisionCategories.Land;
1263 }
1264 else
1265 {
1266 m_collisionCategories |= CollisionCategories.Body;
1267 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1268 }
1246 1269
1247 foreach (OdePrim prm in childrenPrim) 1270 foreach (OdePrim prm in childrenPrim)
1248 { 1271 {
@@ -1496,6 +1519,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1496 collide_geom = m_targetSpace; 1519 collide_geom = m_targetSpace;
1497 } 1520 }
1498 1521
1522 if (m_delaySelect)
1523 {
1524 m_isSelected = true;
1525 m_delaySelect = false;
1526 }
1527
1499 lock (childrenPrim) 1528 lock (childrenPrim)
1500 { 1529 {
1501 foreach (OdePrim prm in childrenPrim) 1530 foreach (OdePrim prm in childrenPrim)
@@ -1526,8 +1555,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1526 } 1555 }
1527 else 1556 else
1528 { 1557 {
1529 prm.m_collisionCategories |= CollisionCategories.Body; 1558 if (m_isphantom && !m_isVolumeDetect)
1530 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); 1559 {
1560 prm.m_collisionCategories = 0;
1561 prm.m_collisionFlags = CollisionCategories.Land;
1562 }
1563 else
1564 {
1565 prm.m_collisionCategories |= CollisionCategories.Body;
1566 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1567 }
1531 d.GeomEnable(prm.prim_geom); 1568 d.GeomEnable(prm.prim_geom);
1532 } 1569 }
1533 1570
@@ -1567,8 +1604,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1567 } 1604 }
1568 else 1605 else
1569 { 1606 {
1570 m_collisionCategories |= CollisionCategories.Body; 1607 if (m_isphantom && !m_isVolumeDetect)
1571 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); 1608 {
1609 m_collisionCategories = 0;
1610 m_collisionFlags = CollisionCategories.Land;
1611 }
1612 else
1613 {
1614 m_collisionCategories |= CollisionCategories.Body;
1615 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1616 }
1572 1617
1573 d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); 1618 d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
1574 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); 1619 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
@@ -2275,6 +2320,88 @@ namespace OpenSim.Region.Physics.OdePlugin
2275 } 2320 }
2276 } 2321 }
2277 2322
2323
2324 private void changePhantomStatus(bool newval)
2325 {
2326 m_isphantom = newval;
2327
2328 if (m_isSelected)
2329 {
2330 m_collisionCategories = CollisionCategories.Selected;
2331 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
2332 }
2333 else
2334 {
2335 if (m_isphantom && !m_isVolumeDetect)
2336 {
2337 m_collisionCategories = 0;
2338 if (m_isphysical)
2339 m_collisionFlags = CollisionCategories.Land;
2340 else
2341 m_collisionFlags = 0; // should never happen
2342 }
2343
2344 else
2345 {
2346 m_collisionCategories = CollisionCategories.Geom;
2347 if (m_isphysical)
2348 m_collisionCategories |= CollisionCategories.Body;
2349
2350 m_collisionFlags = m_default_collisionFlags | CollisionCategories.Land;
2351
2352 if (m_collidesWater)
2353 m_collisionFlags |= CollisionCategories.Water;
2354 }
2355 }
2356
2357 if (!childPrim)
2358 {
2359 foreach (OdePrim prm in childrenPrim)
2360 {
2361 prm.m_collisionCategories = m_collisionCategories;
2362 prm.m_collisionFlags = m_collisionFlags;
2363
2364 if (!prm.m_disabled && prm.prim_geom != IntPtr.Zero)
2365 {
2366 if (prm.m_NoColide)
2367 {
2368 d.GeomSetCategoryBits(prm.prim_geom, 0);
2369 if (m_isphysical)
2370 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
2371 else
2372 d.GeomSetCollideBits(prm.prim_geom, 0);
2373 }
2374 else
2375 {
2376 d.GeomSetCategoryBits(prm.prim_geom, (int)m_collisionCategories);
2377 d.GeomSetCollideBits(prm.prim_geom, (int)m_collisionFlags);
2378 }
2379 if(!m_isSelected)
2380 d.GeomEnable(prm.prim_geom);
2381 }
2382 }
2383 }
2384
2385 if (!m_disabled && prim_geom != IntPtr.Zero)
2386 {
2387 if (m_NoColide)
2388 {
2389 d.GeomSetCategoryBits(prim_geom, 0);
2390 if (m_isphysical)
2391 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
2392 else
2393 d.GeomSetCollideBits(prim_geom, 0);
2394 }
2395 else
2396 {
2397 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
2398 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2399 }
2400 if(!m_isSelected)
2401 d.GeomEnable(prim_geom);
2402 }
2403 }
2404
2278 private void changeSelectedStatus(bool newval) 2405 private void changeSelectedStatus(bool newval)
2279 { 2406 {
2280 if (m_lastdoneSelected == newval) 2407 if (m_lastdoneSelected == newval)
@@ -2350,7 +2477,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2350 2477
2351 m_delaySelect = false; 2478 m_delaySelect = false;
2352 } 2479 }
2353 else 2480 else if(!m_isphysical)
2354 { 2481 {
2355 m_delaySelect = true; 2482 m_delaySelect = true;
2356 } 2483 }
@@ -2617,30 +2744,12 @@ namespace OpenSim.Region.Physics.OdePlugin
2617 if (NewStatus) 2744 if (NewStatus)
2618 { 2745 {
2619 if (Body == IntPtr.Zero) 2746 if (Body == IntPtr.Zero)
2620 { 2747 MakeBody();
2621 /*
2622 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2623 {
2624 changeShape(_pbs);
2625 }
2626 else
2627 */
2628 {
2629 MakeBody();
2630 }
2631 }
2632 } 2748 }
2633 else 2749 else
2634 { 2750 {
2635 if (Body != IntPtr.Zero) 2751 if (Body != IntPtr.Zero)
2636 { 2752 {
2637 // UpdateChildsfromgeom();
2638 /* if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2639 {
2640 changeShape(_pbs);
2641 }
2642 else
2643 */
2644 DestroyBody(); 2753 DestroyBody();
2645 } 2754 }
2646 Stop(); 2755 Stop();
@@ -2724,7 +2833,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2724 { 2833 {
2725 m_collidesWater = newval; 2834 m_collidesWater = newval;
2726 2835
2727 if (prim_geom != IntPtr.Zero) 2836 if (prim_geom != IntPtr.Zero && !m_isphantom)
2728 { 2837 {
2729 if (m_collidesWater) 2838 if (m_collidesWater)
2730 { 2839 {
@@ -3496,6 +3605,10 @@ namespace OpenSim.Region.Physics.OdePlugin
3496 changeVolumedetetion((bool)arg); 3605 changeVolumedetetion((bool)arg);
3497 break; 3606 break;
3498 3607
3608 case changes.Phantom:
3609 changePhantomStatus((bool)arg);
3610 break;
3611
3499 case changes.Physical: 3612 case changes.Physical:
3500 changePhysicsStatus((bool)arg); 3613 changePhysicsStatus((bool)arg);
3501 break; 3614 break;