aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-12 16:29:03 -0800
committerRobert Adams2012-12-12 16:51:43 -0800
commite1814aa827c2d0af21d087bd34e3c7f4f7cf25bd (patch)
tree283bcee9a3320a93e9c252937f754c5962f9a19d /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
parentBulletSim: non-functional commenting and reorganization of material attribute... (diff)
downloadopensim-SC_OLD-e1814aa827c2d0af21d087bd34e3c7f4f7cf25bd.zip
opensim-SC_OLD-e1814aa827c2d0af21d087bd34e3c7f4f7cf25bd.tar.gz
opensim-SC_OLD-e1814aa827c2d0af21d087bd34e3c7f4f7cf25bd.tar.bz2
opensim-SC_OLD-e1814aa827c2d0af21d087bd34e3c7f4f7cf25bd.tar.xz
BulletSim: fix problem of avatar's floating off the ground after unsitting. Reworked size/scale logic so physical scale is kept in Bullet and physObject scale is the preferred size -- usually same as size but avatars are computed differently.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs23
1 files changed, 14 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 4ab9a99..ea996ae 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -126,6 +126,11 @@ public sealed class BSShapeCollection : IDisposable
126 return ret; 126 return ret;
127 } 127 }
128 128
129 public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim)
130 {
131 return GetBodyAndShape(forceRebuild, sim, prim, null, null);
132 }
133
129 // Track another user of a body. 134 // Track another user of a body.
130 // We presume the caller has allocated the body. 135 // We presume the caller has allocated the body.
131 // Bodies only have one user so the body is just put into the world if not already there. 136 // Bodies only have one user so the body is just put into the world if not already there.
@@ -460,6 +465,11 @@ public sealed class BSShapeCollection : IDisposable
460 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 465 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100
461 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) 466 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) )
462 { 467 {
468 // Get the scale of any existing shape so we can see if the new shape is same native type and same size.
469 OMV.Vector3 scaleOfExistingShape = OMV.Vector3.Zero;
470 if (prim.PhysShape.HasPhysicalShape)
471 scaleOfExistingShape = BulletSimAPI.GetLocalScaling2(prim.PhysShape.ptr);
472
463 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", 473 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}",
464 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); 474 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type);
465 475
@@ -469,7 +479,7 @@ public sealed class BSShapeCollection : IDisposable
469 { 479 {
470 haveShape = true; 480 haveShape = true;
471 if (forceRebuild 481 if (forceRebuild
472 || prim.Scale != prim.Size 482 || prim.Scale != scaleOfExistingShape
473 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE 483 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE
474 ) 484 )
475 { 485 {
@@ -483,7 +493,7 @@ public sealed class BSShapeCollection : IDisposable
483 { 493 {
484 haveShape = true; 494 haveShape = true;
485 if (forceRebuild 495 if (forceRebuild
486 || prim.Scale != prim.Size 496 || prim.Scale != scaleOfExistingShape
487 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX 497 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX
488 ) 498 )
489 { 499 {
@@ -542,7 +552,6 @@ public sealed class BSShapeCollection : IDisposable
542 prim.LocalID, newShape, prim.Scale); 552 prim.LocalID, newShape, prim.Scale);
543 553
544 // native shapes are scaled by Bullet 554 // native shapes are scaled by Bullet
545 prim.Scale = prim.Size;
546 prim.PhysShape = newShape; 555 prim.PhysShape = newShape;
547 return true; 556 return true;
548 } 557 }
@@ -555,8 +564,8 @@ public sealed class BSShapeCollection : IDisposable
555 ShapeData nativeShapeData = new ShapeData(); 564 ShapeData nativeShapeData = new ShapeData();
556 nativeShapeData.Type = shapeType; 565 nativeShapeData.Type = shapeType;
557 nativeShapeData.ID = prim.LocalID; 566 nativeShapeData.ID = prim.LocalID;
558 nativeShapeData.Scale = prim.Size; 567 nativeShapeData.Scale = prim.Scale;
559 nativeShapeData.Size = prim.Size; // unneeded, I think. 568 nativeShapeData.Size = prim.Scale; // unneeded, I think.
560 nativeShapeData.MeshKey = (ulong)shapeKey; 569 nativeShapeData.MeshKey = (ulong)shapeKey;
561 nativeShapeData.HullKey = (ulong)shapeKey; 570 nativeShapeData.HullKey = (ulong)shapeKey;
562 571
@@ -611,8 +620,6 @@ public sealed class BSShapeCollection : IDisposable
611 620
612 ReferenceShape(newShape); 621 ReferenceShape(newShape);
613 622
614 // meshes are already scaled by the meshmerizer
615 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
616 prim.PhysShape = newShape; 623 prim.PhysShape = newShape;
617 624
618 return true; // 'true' means a new shape has been added to this prim 625 return true; // 'true' means a new shape has been added to this prim
@@ -683,8 +690,6 @@ public sealed class BSShapeCollection : IDisposable
683 690
684 ReferenceShape(newShape); 691 ReferenceShape(newShape);
685 692
686 // hulls are already scaled by the meshmerizer
687 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
688 prim.PhysShape = newShape; 693 prim.PhysShape = newShape;
689 return true; // 'true' means a new shape has been added to this prim 694 return true; // 'true' means a new shape has been added to this prim
690 } 695 }