aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-12-04 02:46:40 +0000
committerUbitUmarov2012-12-04 02:46:40 +0000
commitb6d29aa124cf1ec1c1dbe6874720e6cc39faf06f (patch)
treee71a0e511e0b070d4ab28f4012c82860fe99cd48 /OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
parentraise standing avatar a bit to reduce knees bending on some collisions. (diff)
downloadopensim-SC-b6d29aa124cf1ec1c1dbe6874720e6cc39faf06f.zip
opensim-SC-b6d29aa124cf1ec1c1dbe6874720e6cc39faf06f.tar.gz
opensim-SC-b6d29aa124cf1ec1c1dbe6874720e6cc39faf06f.tar.bz2
opensim-SC-b6d29aa124cf1ec1c1dbe6874720e6cc39faf06f.tar.xz
move characters (avatars) to own collision space, also fixing a problem
with previus code that was still assuming the avatar is g2
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs40
1 files changed, 35 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 003a91c..07987d1 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -299,6 +299,7 @@ namespace OpenSim.Region.Physics.OdePlugin
299 299
300 public IntPtr TopSpace; // the global space 300 public IntPtr TopSpace; // the global space
301 public IntPtr ActiveSpace; // space for active prims 301 public IntPtr ActiveSpace; // space for active prims
302 public IntPtr CharsSpace; // space for active prims
302 public IntPtr StaticSpace; // space for the static things around 303 public IntPtr StaticSpace; // space for the static things around
303 public IntPtr GroundSpace; // space for ground 304 public IntPtr GroundSpace; // space for ground
304 305
@@ -372,21 +373,25 @@ namespace OpenSim.Region.Physics.OdePlugin
372 373
373 // now the major subspaces 374 // now the major subspaces
374 ActiveSpace = d.HashSpaceCreate(TopSpace); 375 ActiveSpace = d.HashSpaceCreate(TopSpace);
376 CharsSpace = d.HashSpaceCreate(TopSpace);
375 StaticSpace = d.HashSpaceCreate(TopSpace); 377 StaticSpace = d.HashSpaceCreate(TopSpace);
376 GroundSpace = d.HashSpaceCreate(TopSpace); 378 GroundSpace = d.HashSpaceCreate(TopSpace);
377 } 379 }
378 catch 380 catch
379 { 381 {
380 // i must RtC#FM 382 // i must RtC#FM
383 // i did!
381 } 384 }
382 385
383 d.HashSpaceSetLevels(TopSpace, -2, 8); 386 d.HashSpaceSetLevels(TopSpace, -2, 8);
384 d.HashSpaceSetLevels(ActiveSpace, -2, 8); 387 d.HashSpaceSetLevels(ActiveSpace, -2, 8);
388 d.HashSpaceSetLevels(CharsSpace, -4, 3);
385 d.HashSpaceSetLevels(StaticSpace, -2, 8); 389 d.HashSpaceSetLevels(StaticSpace, -2, 8);
386 d.HashSpaceSetLevels(GroundSpace, 0, 8); 390 d.HashSpaceSetLevels(GroundSpace, 0, 8);
387 391
388 // demote to second level 392 // demote to second level
389 d.SpaceSetSublevel(ActiveSpace, 1); 393 d.SpaceSetSublevel(ActiveSpace, 1);
394 d.SpaceSetSublevel(CharsSpace, 1);
390 d.SpaceSetSublevel(StaticSpace, 1); 395 d.SpaceSetSublevel(StaticSpace, 1);
391 d.SpaceSetSublevel(GroundSpace, 1); 396 d.SpaceSetSublevel(GroundSpace, 1);
392 397
@@ -396,11 +401,24 @@ namespace OpenSim.Region.Physics.OdePlugin
396 CollisionCategories.Phantom | 401 CollisionCategories.Phantom |
397 CollisionCategories.VolumeDtc 402 CollisionCategories.VolumeDtc
398 )); 403 ));
399 d.GeomSetCollideBits(ActiveSpace, 0); 404 d.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space |
405 CollisionCategories.Geom |
406 CollisionCategories.Character |
407 CollisionCategories.Phantom |
408 CollisionCategories.VolumeDtc
409 ));
410 d.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space |
411 CollisionCategories.Geom |
412 CollisionCategories.Character |
413 CollisionCategories.Phantom |
414 CollisionCategories.VolumeDtc
415 ));
416 d.GeomSetCollideBits(CharsSpace, 0);
417
400 d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space | 418 d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
401 CollisionCategories.Geom | 419 CollisionCategories.Geom |
402 CollisionCategories.Land | 420// CollisionCategories.Land |
403 CollisionCategories.Water | 421// CollisionCategories.Water |
404 CollisionCategories.Phantom | 422 CollisionCategories.Phantom |
405 CollisionCategories.VolumeDtc 423 CollisionCategories.VolumeDtc
406 )); 424 ));
@@ -1271,6 +1289,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1271 d.SpaceCollide2(StaticSpace, chr.midbox, IntPtr.Zero, nearCallback); 1289 d.SpaceCollide2(StaticSpace, chr.midbox, IntPtr.Zero, nearCallback);
1272 d.SpaceCollide2(StaticSpace, chr.feetbox, IntPtr.Zero, nearCallback); 1290 d.SpaceCollide2(StaticSpace, chr.feetbox, IntPtr.Zero, nearCallback);
1273 d.SpaceCollide2(StaticSpace, chr.bonebox, IntPtr.Zero, nearCallback); 1291 d.SpaceCollide2(StaticSpace, chr.bonebox, IntPtr.Zero, nearCallback);
1292
1293 // chars with chars
1294 d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback);
1274 // no coll with gnd 1295 // no coll with gnd
1275 } 1296 }
1276 } 1297 }
@@ -1312,16 +1333,25 @@ namespace OpenSim.Region.Physics.OdePlugin
1312 m_log.Warn("[PHYSICS]: Unable to collide Active prim to static space"); 1333 m_log.Warn("[PHYSICS]: Unable to collide Active prim to static space");
1313 } 1334 }
1314 } 1335 }
1315 // finally colide active things amoung them 1336 // colide active amoung them
1316 try 1337 try
1317 { 1338 {
1318 d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback); 1339 d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback);
1319 } 1340 }
1320 catch (AccessViolationException) 1341 catch (AccessViolationException)
1321 { 1342 {
1343 m_log.Warn("[PHYSICS]: Unable to collide Active with Characters space");
1344 }
1345 // and with chars
1346 try
1347 {
1348 d.SpaceCollide2(ActiveSpace, CharsSpace,IntPtr.Zero, nearCallback);
1349 }
1350 catch (AccessViolationException)
1351 {
1322 m_log.Warn("[PHYSICS]: Unable to collide in Active space"); 1352 m_log.Warn("[PHYSICS]: Unable to collide in Active space");
1323 } 1353 }
1324// _perloopContact.Clear(); 1354 // _perloopContact.Clear();
1325 } 1355 }
1326 1356
1327 #endregion 1357 #endregion