aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 83c78f6..c8aad8d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -105,12 +105,12 @@ public sealed class BSCharacter : BSPhysObject
105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", 105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass); 106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass);
107 107
108 // do actual create at taint time 108 // do actual creation in taint time
109 PhysicsScene.TaintedObject("BSCharacter.create", delegate() 109 PhysicsScene.TaintedObject("BSCharacter.create", delegate()
110 { 110 {
111 DetailLog("{0},BSCharacter.create,taint", LocalID); 111 DetailLog("{0},BSCharacter.create,taint", LocalID);
112 // New body and shape into PhysBody and PhysShape 112 // New body and shape into PhysBody and PhysShape
113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); 113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
114 114
115 SetPhysicalProperties(); 115 SetPhysicalProperties();
116 }); 116 });
@@ -189,6 +189,11 @@ public sealed class BSCharacter : BSPhysObject
189 set { 189 set {
190 // When an avatar's size is set, only the height is changed. 190 // When an avatar's size is set, only the height is changed.
191 _size = value; 191 _size = value;
192 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
193 // replace with the default values.
194 if (_size.X == 0f) _size.X = PhysicsScene.Params.avatarCapsuleDepth;
195 if (_size.Y == 0f) _size.Y = PhysicsScene.Params.avatarCapsuleWidth;
196
192 ComputeAvatarScale(_size); 197 ComputeAvatarScale(_size);
193 ComputeAvatarVolumeAndMass(); 198 ComputeAvatarVolumeAndMass();
194 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", 199 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}",
@@ -196,18 +201,18 @@ public sealed class BSCharacter : BSPhysObject
196 201
197 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 202 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
198 { 203 {
199 if (PhysShape.HasPhysicalShape) 204 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
200 { 205 {
201 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 206 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
202 UpdatePhysicalMassProperties(RawMass); 207 UpdatePhysicalMassProperties(RawMass);
208 // Make sure this change appears as a property update event
209 BulletSimAPI.PushUpdate2(PhysBody.ptr);
203 } 210 }
204 }); 211 });
205 212
206 } 213 }
207 } 214 }
208 215
209 public override OMV.Vector3 Scale { get; set; }
210
211 public override PrimitiveBaseShape Shape 216 public override PrimitiveBaseShape Shape
212 { 217 {
213 set { BaseShape = value; } 218 set { BaseShape = value; }
@@ -638,9 +643,6 @@ public sealed class BSCharacter : BSPhysObject
638 643
639 private void ComputeAvatarScale(OMV.Vector3 size) 644 private void ComputeAvatarScale(OMV.Vector3 size)
640 { 645 {
641 // The 'size' given by the simulator is the mid-point of the avatar
642 // and X and Y are unspecified.
643
644 OMV.Vector3 newScale = size; 646 OMV.Vector3 newScale = size;
645 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth; 647 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth;
646 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth; 648 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth;