diff options
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 173 |
1 files changed, 145 insertions, 28 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 563d527..5d8f03c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -66,6 +66,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
66 | 66 | ||
67 | private bool m_isphysical; | 67 | private bool m_isphysical; |
68 | private bool m_fakeisphysical; | 68 | private bool m_fakeisphysical; |
69 | private bool m_isphantom; | ||
70 | private bool m_fakeisphantom; | ||
69 | 71 | ||
70 | protected bool m_building; | 72 | protected bool m_building; |
71 | private Quaternion m_lastorientation = new Quaternion(); | 73 | private Quaternion m_lastorientation = new Quaternion(); |
@@ -211,6 +213,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
211 | } | 213 | } |
212 | } | 214 | } |
213 | 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 | |||
214 | public override bool Building // this is not reliable for internal use | 229 | public override bool Building // this is not reliable for internal use |
215 | { | 230 | { |
216 | get { return m_building; } | 231 | get { return m_building; } |
@@ -831,9 +846,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
831 | 846 | ||
832 | 847 | ||
833 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, | 848 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
834 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) | 849 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,uint plocalID) |
835 | { | 850 | { |
836 | Name = primName; | 851 | Name = primName; |
852 | LocalID = plocalID; | ||
837 | 853 | ||
838 | m_vehicle = null; | 854 | m_vehicle = null; |
839 | 855 | ||
@@ -908,6 +924,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
908 | m_isSelected = false; | 924 | m_isSelected = false; |
909 | m_delaySelect = false; | 925 | m_delaySelect = false; |
910 | 926 | ||
927 | m_isphantom = pisPhantom; | ||
928 | m_fakeisphantom = pisPhantom; | ||
929 | |||
911 | mu = parent_scene.m_materialContactsData[(int)Material.Wood].mu; | 930 | mu = parent_scene.m_materialContactsData[(int)Material.Wood].mu; |
912 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; | 931 | bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce; |
913 | 932 | ||
@@ -1237,8 +1256,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1237 | { | 1256 | { |
1238 | if (m_isphysical && Body != IntPtr.Zero) | 1257 | if (m_isphysical && Body != IntPtr.Zero) |
1239 | { | 1258 | { |
1240 | m_collisionCategories |= CollisionCategories.Body; | 1259 | if (m_isphantom && !m_isVolumeDetect) |
1241 | 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 | } | ||
1242 | 1269 | ||
1243 | foreach (OdePrim prm in childrenPrim) | 1270 | foreach (OdePrim prm in childrenPrim) |
1244 | { | 1271 | { |
@@ -1492,6 +1519,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1492 | collide_geom = m_targetSpace; | 1519 | collide_geom = m_targetSpace; |
1493 | } | 1520 | } |
1494 | 1521 | ||
1522 | if (m_delaySelect) | ||
1523 | { | ||
1524 | m_isSelected = true; | ||
1525 | m_delaySelect = false; | ||
1526 | } | ||
1527 | |||
1495 | lock (childrenPrim) | 1528 | lock (childrenPrim) |
1496 | { | 1529 | { |
1497 | foreach (OdePrim prm in childrenPrim) | 1530 | foreach (OdePrim prm in childrenPrim) |
@@ -1522,8 +1555,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1522 | } | 1555 | } |
1523 | else | 1556 | else |
1524 | { | 1557 | { |
1525 | prm.m_collisionCategories |= CollisionCategories.Body; | 1558 | if (m_isphantom && !m_isVolumeDetect) |
1526 | 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 | } | ||
1527 | d.GeomEnable(prm.prim_geom); | 1568 | d.GeomEnable(prm.prim_geom); |
1528 | } | 1569 | } |
1529 | 1570 | ||
@@ -1563,8 +1604,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1563 | } | 1604 | } |
1564 | else | 1605 | else |
1565 | { | 1606 | { |
1566 | m_collisionCategories |= CollisionCategories.Body; | 1607 | if (m_isphantom && !m_isVolumeDetect) |
1567 | 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 | } | ||
1568 | 1617 | ||
1569 | 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); |
1570 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); | 1619 | d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); |
@@ -2271,6 +2320,88 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2271 | } | 2320 | } |
2272 | } | 2321 | } |
2273 | 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 | |||
2274 | private void changeSelectedStatus(bool newval) | 2405 | private void changeSelectedStatus(bool newval) |
2275 | { | 2406 | { |
2276 | if (m_lastdoneSelected == newval) | 2407 | if (m_lastdoneSelected == newval) |
@@ -2346,7 +2477,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2346 | 2477 | ||
2347 | m_delaySelect = false; | 2478 | m_delaySelect = false; |
2348 | } | 2479 | } |
2349 | else | 2480 | else if(!m_isphysical) |
2350 | { | 2481 | { |
2351 | m_delaySelect = true; | 2482 | m_delaySelect = true; |
2352 | } | 2483 | } |
@@ -2613,30 +2744,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2613 | if (NewStatus) | 2744 | if (NewStatus) |
2614 | { | 2745 | { |
2615 | if (Body == IntPtr.Zero) | 2746 | if (Body == IntPtr.Zero) |
2616 | { | 2747 | MakeBody(); |
2617 | /* | ||
2618 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | ||
2619 | { | ||
2620 | changeShape(_pbs); | ||
2621 | } | ||
2622 | else | ||
2623 | */ | ||
2624 | { | ||
2625 | MakeBody(); | ||
2626 | } | ||
2627 | } | ||
2628 | } | 2748 | } |
2629 | else | 2749 | else |
2630 | { | 2750 | { |
2631 | if (Body != IntPtr.Zero) | 2751 | if (Body != IntPtr.Zero) |
2632 | { | 2752 | { |
2633 | // UpdateChildsfromgeom(); | ||
2634 | /* if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | ||
2635 | { | ||
2636 | changeShape(_pbs); | ||
2637 | } | ||
2638 | else | ||
2639 | */ | ||
2640 | DestroyBody(); | 2753 | DestroyBody(); |
2641 | } | 2754 | } |
2642 | Stop(); | 2755 | Stop(); |
@@ -2720,7 +2833,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2720 | { | 2833 | { |
2721 | m_collidesWater = newval; | 2834 | m_collidesWater = newval; |
2722 | 2835 | ||
2723 | if (prim_geom != IntPtr.Zero) | 2836 | if (prim_geom != IntPtr.Zero && !m_isphantom) |
2724 | { | 2837 | { |
2725 | if (m_collidesWater) | 2838 | if (m_collidesWater) |
2726 | { | 2839 | { |
@@ -3492,6 +3605,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3492 | changeVolumedetetion((bool)arg); | 3605 | changeVolumedetetion((bool)arg); |
3493 | break; | 3606 | break; |
3494 | 3607 | ||
3608 | case changes.Phantom: | ||
3609 | changePhantomStatus((bool)arg); | ||
3610 | break; | ||
3611 | |||
3495 | case changes.Physical: | 3612 | case changes.Physical: |
3496 | changePhysicsStatus((bool)arg); | 3613 | changePhysicsStatus((bool)arg); |
3497 | break; | 3614 | break; |