aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
authorRobert Adams2012-11-21 16:31:23 -0800
committerRobert Adams2012-11-21 16:43:53 -0800
commitcbc7e7bf85bfd9e916146b0ae4a605996c24720b (patch)
tree9873174e8174ce230b2b0e8d30c490d0b79db745 /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
parentBulletSim: Properly position mesh terrain on creation (fixes terrain not appe... (diff)
downloadopensim-SC-cbc7e7bf85bfd9e916146b0ae4a605996c24720b.zip
opensim-SC-cbc7e7bf85bfd9e916146b0ae4a605996c24720b.tar.gz
opensim-SC-cbc7e7bf85bfd9e916146b0ae4a605996c24720b.tar.bz2
opensim-SC-cbc7e7bf85bfd9e916146b0ae4a605996c24720b.tar.xz
BulletSim: Make avatar capsule so it is not circular.
Simple attempt to make avatars better shaped. Replace parameter 'avatarCapsuleRadius' with 'avatarCapsuleWidth' and 'avatarCapsuleDepth'. More tweeking to avatar height calculation. A little better but short avatar's feet are above the terrain and tall avatar's feet are a little below the ground.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs24
1 files changed, 17 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 799211e..e2aa41e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -82,7 +82,13 @@ public sealed class BSCharacter : BSPhysObject
82 { 82 {
83 _physicsActorType = (int)ActorTypes.Agent; 83 _physicsActorType = (int)ActorTypes.Agent;
84 _position = pos; 84 _position = pos;
85
86 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
87 // replace with the default values.
85 _size = size; 88 _size = size;
89 if (_size.X == 0f) _size.X = PhysicsScene.Params.avatarCapsuleDepth;
90 if (_size.Y == 0f) _size.Y = PhysicsScene.Params.avatarCapsuleWidth;
91
86 _flying = isFlying; 92 _flying = isFlying;
87 _orientation = OMV.Quaternion.Identity; 93 _orientation = OMV.Quaternion.Identity;
88 _velocity = OMV.Vector3.Zero; 94 _velocity = OMV.Vector3.Zero;
@@ -175,8 +181,7 @@ public sealed class BSCharacter : BSPhysObject
175 get 181 get
176 { 182 {
177 // Avatar capsule size is kept in the scale parameter. 183 // Avatar capsule size is kept in the scale parameter.
178 // return _size; 184 return _size;
179 return new OMV.Vector3(Scale.X * 2f, Scale.Y * 2f, Scale.Z);
180 } 185 }
181 186
182 set { 187 set {
@@ -614,14 +619,19 @@ public sealed class BSCharacter : BSPhysObject
614 // The 'size' given by the simulator is the mid-point of the avatar 619 // The 'size' given by the simulator is the mid-point of the avatar
615 // and X and Y are unspecified. 620 // and X and Y are unspecified.
616 621
617 OMV.Vector3 newScale = OMV.Vector3.Zero; 622 OMV.Vector3 newScale = size;
618 newScale.X = PhysicsScene.Params.avatarCapsuleRadius; 623 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth;
619 newScale.Y = PhysicsScene.Params.avatarCapsuleRadius; 624 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth;
620 625
621 // From the total height, remove the capsule half spheres that are at each end 626 // From the total height, remove the capsule half spheres that are at each end
622 // The 1.15f came from ODE. Not sure what this factors in. 627 // The 1.15f came from ODE. Not sure what this factors in.
623 newScale.Z = (size.Z * 1.15f) - (newScale.X + newScale.Y); 628 // newScale.Z = (size.Z * 1.15f) - (newScale.X + newScale.Y);
624 Scale = newScale; 629
630 // The total scale height is the central cylindar plus the caps on the two ends.
631 newScale.Z = size.Z + (Math.Min(size.X, size.Y) * 2f);
632
633 // Convert diameters to radii and height to half height -- the way Bullet expects it.
634 Scale = newScale / 2f;
625 } 635 }
626 636
627 // set _avatarVolume and _mass based on capsule size, _density and Scale 637 // set _avatarVolume and _mass based on capsule size, _density and Scale