aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs41
1 files changed, 31 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 4c54f9f..f29784a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -64,15 +64,25 @@ public sealed class BSCharacter : BSPhysObject
64 private bool _usePID; 64 private bool _usePID;
65 private float _PIDTau; 65 private float _PIDTau;
66 66
67 public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying) 67// public override OMV.Vector3 RawVelocity
68// { get { return base.RawVelocity; }
69// set {
70// if (value != base.RawVelocity)
71// Util.PrintCallStack();
72// Console.WriteLine("Set rawvel to {0}", value);
73// base.RawVelocity = value; }
74// }
75
76 public BSCharacter(
77 uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying)
68 : base(parent_scene, localID, avName, "BSCharacter") 78 : base(parent_scene, localID, avName, "BSCharacter")
69 { 79 {
70 _physicsActorType = (int)ActorTypes.Agent; 80 _physicsActorType = (int)ActorTypes.Agent;
71 RawPosition = pos; 81 RawPosition = pos;
72 82
73 _flying = isFlying; 83 _flying = isFlying;
74 RawOrientation = OMV.Quaternion.Identity; 84 RawOrientation = OMV.Quaternion.Identity;
75 RawVelocity = OMV.Vector3.Zero; 85 RawVelocity = vel;
76 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 86 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
77 Friction = BSParam.AvatarStandingFriction; 87 Friction = BSParam.AvatarStandingFriction;
78 Density = BSParam.AvatarDensity; 88 Density = BSParam.AvatarDensity;
@@ -89,13 +99,15 @@ public sealed class BSCharacter : BSPhysObject
89 // set _avatarVolume and _mass based on capsule size, _density and Scale 99 // set _avatarVolume and _mass based on capsule size, _density and Scale
90 ComputeAvatarVolumeAndMass(); 100 ComputeAvatarVolumeAndMass();
91 101
92 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}", 102 DetailLog(
93 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos); 103 "{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6},vel={7}",
104 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos, vel);
94 105
95 // do actual creation in taint time 106 // do actual creation in taint time
96 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate() 107 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate()
97 { 108 {
98 DetailLog("{0},BSCharacter.create,taint", LocalID); 109 DetailLog("{0},BSCharacter.create,taint", LocalID);
110
99 // New body and shape into PhysBody and PhysShape 111 // New body and shape into PhysBody and PhysShape
100 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); 112 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this);
101 113
@@ -142,6 +154,7 @@ public sealed class BSCharacter : BSPhysObject
142 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false); 154 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false);
143 155
144 ForceVelocity = RawVelocity; 156 ForceVelocity = RawVelocity;
157 TargetVelocity = RawVelocity;
145 158
146 // This will enable or disable the flying buoyancy of the avatar. 159 // This will enable or disable the flying buoyancy of the avatar.
147 // Needs to be reset especially when an avatar is recreated after crossing a region boundry. 160 // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
@@ -256,7 +269,6 @@ public sealed class BSCharacter : BSPhysObject
256 // Called at taint time! 269 // Called at taint time!
257 public override void ZeroMotion(bool inTaintTime) 270 public override void ZeroMotion(bool inTaintTime)
258 { 271 {
259 RawVelocity = OMV.Vector3.Zero;
260 _acceleration = OMV.Vector3.Zero; 272 _acceleration = OMV.Vector3.Zero;
261 _rotationalVelocity = OMV.Vector3.Zero; 273 _rotationalVelocity = OMV.Vector3.Zero;
262 274
@@ -267,6 +279,7 @@ public sealed class BSCharacter : BSPhysObject
267 PhysScene.PE.ClearAllForces(PhysBody); 279 PhysScene.PE.ClearAllForces(PhysBody);
268 }); 280 });
269 } 281 }
282
270 public override void ZeroAngularMotion(bool inTaintTime) 283 public override void ZeroAngularMotion(bool inTaintTime)
271 { 284 {
272 _rotationalVelocity = OMV.Vector3.Zero; 285 _rotationalVelocity = OMV.Vector3.Zero;
@@ -441,32 +454,40 @@ public sealed class BSCharacter : BSPhysObject
441 get { return RawVelocity; } 454 get { return RawVelocity; }
442 set { 455 set {
443 RawVelocity = value; 456 RawVelocity = value;
444 // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity); 457 OMV.Vector3 vel = RawVelocity;
458
459 DetailLog("{0}: set Velocity = {1}", LogHeader, value);
460
445 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate() 461 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate()
446 { 462 {
447 if (m_moveActor != null) 463 if (m_moveActor != null)
448 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */); 464 m_moveActor.SetVelocityAndTarget(vel, vel, true /* inTaintTime */);
449 465
450 DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, RawVelocity); 466 m_log.DebugFormat("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, vel);
451 ForceVelocity = RawVelocity; 467 ForceVelocity = vel;
452 }); 468 });
453 } 469 }
454 } 470 }
471
455 public override OMV.Vector3 ForceVelocity { 472 public override OMV.Vector3 ForceVelocity {
456 get { return RawVelocity; } 473 get { return RawVelocity; }
457 set { 474 set {
458 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); 475 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
476// Util.PrintCallStack();
477 DetailLog("{0}: set ForceVelocity = {1}", LogHeader, value);
459 478
460 RawVelocity = value; 479 RawVelocity = value;
461 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); 480 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
462 PhysScene.PE.Activate(PhysBody, true); 481 PhysScene.PE.Activate(PhysBody, true);
463 } 482 }
464 } 483 }
484
465 public override OMV.Vector3 Torque { 485 public override OMV.Vector3 Torque {
466 get { return RawTorque; } 486 get { return RawTorque; }
467 set { RawTorque = value; 487 set { RawTorque = value;
468 } 488 }
469 } 489 }
490
470 public override float CollisionScore { 491 public override float CollisionScore {
471 get { return _collisionScore; } 492 get { return _collisionScore; }
472 set { _collisionScore = value; 493 set { _collisionScore = value;