aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs5
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs41
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs6
4 files changed, 40 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 14518e9..8e998ba 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
34 35
35using OMV = OpenMetaverse; 36using OMV = OpenMetaverse;
@@ -109,6 +110,10 @@ public class BSActorAvatarMove : BSActor
109 { 110 {
110 if (m_velocityMotor != null) 111 if (m_velocityMotor != null)
111 { 112 {
113// if (targ == OMV.Vector3.Zero)
114// Util.PrintCallStack();
115//
116// Console.WriteLine("SetVelocityAndTarget, {0} {1}", vel, targ);
112 m_velocityMotor.Reset(); 117 m_velocityMotor.Reset();
113 m_velocityMotor.SetTarget(targ); 118 m_velocityMotor.SetTarget(targ);
114 m_velocityMotor.SetCurrent(vel); 119 m_velocityMotor.SetCurrent(vel);
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;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f059322..e4d8df8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -228,7 +228,7 @@ public abstract class BSPhysObject : PhysicsActor
228 public virtual OMV.Quaternion RawOrientation { get; set; } 228 public virtual OMV.Quaternion RawOrientation { get; set; }
229 public abstract OMV.Quaternion ForceOrientation { get; set; } 229 public abstract OMV.Quaternion ForceOrientation { get; set; }
230 230
231 public OMV.Vector3 RawVelocity { get; set; } 231 public virtual OMV.Vector3 RawVelocity { get; set; }
232 public abstract OMV.Vector3 ForceVelocity { get; set; } 232 public abstract OMV.Vector3 ForceVelocity { get; set; }
233 233
234 public OMV.Vector3 RawForce { get; set; } 234 public OMV.Vector3 RawForce { get; set; }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0f79a10..414bc92 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -461,19 +461,19 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
461 461
462 #region Prim and Avatar addition and removal 462 #region Prim and Avatar addition and removal
463 463
464 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 464 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
465 { 465 {
466 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); 466 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader);
467 return null; 467 return null;
468 } 468 }
469 469
470 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 470 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
471 { 471 {
472 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); 472 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
473 473
474 if (!m_initialized) return null; 474 if (!m_initialized) return null;
475 475
476 BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); 476 BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
477 lock (PhysObjects) 477 lock (PhysObjects)
478 PhysObjects.Add(localID, actor); 478 PhysObjects.Add(localID, actor);
479 479