diff options
author | Justin Clark-Casey (justincc) | 2012-12-13 01:12:12 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-12-13 01:12:12 +0000 |
commit | 8e8da20af2bf011098ebf68aae80d92da56dae65 (patch) | |
tree | ff368505aa31f0df0fe83d9990ad3c08abb5e02e /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |
parent | Fix sounds so that they play from inventory after teleport rather than only o... (diff) | |
parent | BulletSim: fix problem of avatar's floating off the ground after unsitting. R... (diff) | |
download | opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.zip opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.gz opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.bz2 opensim-SC_OLD-8e8da20af2bf011098ebf68aae80d92da56dae65.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 23 |
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 | } |