aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs28
1 files changed, 26 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 6f22ecf..04bf9a0 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -46,6 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
46 private PhysicsVector _target_velocity; 46 private PhysicsVector _target_velocity;
47 private PhysicsVector _acceleration; 47 private PhysicsVector _acceleration;
48 private PhysicsVector m_rotationalVelocity; 48 private PhysicsVector m_rotationalVelocity;
49 private float m_density = 50f;
49 private bool m_pidControllerActive = true; 50 private bool m_pidControllerActive = true;
50 private static float PID_D = 3020.0f; 51 private static float PID_D = 3020.0f;
51 private static float PID_P = 7000.0f; 52 private static float PID_P = 7000.0f;
@@ -93,7 +94,7 @@ namespace OpenSim.Region.Physics.OdePlugin
93 { 94 {
94 95
95 Shell = d.CreateCapsule(parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 96 Shell = d.CreateCapsule(parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
96 d.MassSetCapsule(out ShellMass, 50.0f, 3, 0.4f, 1.0f); 97 d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
97 Body = d.BodyCreate(parent_scene.world); 98 Body = d.BodyCreate(parent_scene.world);
98 d.BodySetMass(Body, ref ShellMass); 99 d.BodySetMass(Body, ref ShellMass);
99 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); 100 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
@@ -273,7 +274,7 @@ namespace OpenSim.Region.Physics.OdePlugin
273 d.GeomDestroy(Shell); 274 d.GeomDestroy(Shell);
274 //MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH)); 275 //MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH));
275 Shell = d.CreateCapsule(_parent_scene.space, capsuleradius, CAPSULE_LENGTH); 276 Shell = d.CreateCapsule(_parent_scene.space, capsuleradius, CAPSULE_LENGTH);
276 d.MassSetCapsule(out ShellMass, 50.0f, 3, CAPSULE_RADIUS, CAPSULE_LENGTH); 277 d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
277 Body = d.BodyCreate(_parent_scene.world); 278 Body = d.BodyCreate(_parent_scene.world);
278 d.BodySetMass(Body, ref ShellMass); 279 d.BodySetMass(Body, ref ShellMass);
279 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule)); 280 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule));
@@ -283,6 +284,29 @@ namespace OpenSim.Region.Physics.OdePlugin
283 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 284 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
284 } 285 }
285 } 286 }
287 public override float Mass
288 {
289 get {
290
291 float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH);
292 return m_density * AVvolume;
293 }
294 }
295
296 public override PhysicsVector Force
297 {
298 get { return new PhysicsVector(_target_velocity.X,_target_velocity.Y,_target_velocity.Z); }
299 }
300
301 public override PhysicsVector CenterOfMass
302 {
303 get { return PhysicsVector.Zero; }
304 }
305
306 public override PhysicsVector GeometricCenter
307 {
308 get { return PhysicsVector.Zero; }
309 }
286 310
287 public override PrimitiveBaseShape Shape 311 public override PrimitiveBaseShape Shape
288 { 312 {