aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs10
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs8
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs13
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs11
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs83
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs10
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPrim.cs10
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs18
8 files changed, 160 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 9954798..013c9cf 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -381,6 +381,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
381 set { _velocity = value; } 381 set { _velocity = value; }
382 } 382 }
383 383
384 public override PhysicsVector Torque
385 {
386 get { return PhysicsVector.Zero; }
387 set { return; }
388 }
389
384 public override float CollisionScore 390 public override float CollisionScore
385 { 391 {
386 get { return 0f; } 392 get { return 0f; }
@@ -426,6 +432,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
426 { 432 {
427 } 433 }
428 434
435 public override void AddAngularForce(PhysicsVector force, bool pushforce)
436 {
437 }
438
429 public override void SetMomentum(PhysicsVector momentum) 439 public override void SetMomentum(PhysicsVector momentum)
430 { 440 {
431 } 441 }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 20c556f..4f1afdd 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -1134,6 +1134,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1134 public override void AddForce(PhysicsVector force, bool pushforce) 1134 public override void AddForce(PhysicsVector force, bool pushforce)
1135 { 1135 {
1136 } 1136 }
1137 public override PhysicsVector Torque
1138 {
1139 get { return PhysicsVector.Zero; }
1140 set { return; }
1141 }
1142 public override void AddAngularForce(PhysicsVector force, bool pushforce)
1143 {
1144 }
1137 1145
1138 public override void SetMomentum(PhysicsVector momentum) 1146 public override void SetMomentum(PhysicsVector momentum)
1139 { 1147 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 3c094ad..fd02057 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -185,6 +185,7 @@ namespace OpenSim.Region.Physics.Manager
185 public abstract PhysicsVector GeometricCenter { get; } 185 public abstract PhysicsVector GeometricCenter { get; }
186 public abstract PhysicsVector CenterOfMass { get; } 186 public abstract PhysicsVector CenterOfMass { get; }
187 public abstract PhysicsVector Velocity { get; set; } 187 public abstract PhysicsVector Velocity { get; set; }
188 public abstract PhysicsVector Torque { get; set; }
188 public abstract float CollisionScore { get; set;} 189 public abstract float CollisionScore { get; set;}
189 public abstract PhysicsVector Acceleration { get; } 190 public abstract PhysicsVector Acceleration { get; }
190 public abstract Quaternion Orientation { get; set; } 191 public abstract Quaternion Orientation { get; set; }
@@ -204,6 +205,7 @@ namespace OpenSim.Region.Physics.Manager
204 public abstract bool PIDActive { set;} 205 public abstract bool PIDActive { set;}
205 public abstract float PIDTau { set; } 206 public abstract float PIDTau { set; }
206 public abstract void AddForce(PhysicsVector force, bool pushforce); 207 public abstract void AddForce(PhysicsVector force, bool pushforce);
208 public abstract void AddAngularForce(PhysicsVector force, bool pushforce);
207 public abstract void SetMomentum(PhysicsVector momentum); 209 public abstract void SetMomentum(PhysicsVector momentum);
208 public abstract void SubscribeEvents(int ms); 210 public abstract void SubscribeEvents(int ms);
209 public abstract void UnSubscribeEvents(); 211 public abstract void UnSubscribeEvents();
@@ -331,6 +333,12 @@ namespace OpenSim.Region.Physics.Manager
331 set { return; } 333 set { return; }
332 } 334 }
333 335
336 public override PhysicsVector Torque
337 {
338 get { return PhysicsVector.Zero; }
339 set { return; }
340 }
341
334 public override float CollisionScore 342 public override float CollisionScore
335 { 343 {
336 get { return 0f; } 344 get { return 0f; }
@@ -404,6 +412,11 @@ namespace OpenSim.Region.Physics.Manager
404 { 412 {
405 } 413 }
406 414
415 public override void AddAngularForce(PhysicsVector force, bool pushforce)
416 {
417
418 }
419
407 public override PhysicsVector RotationalVelocity 420 public override PhysicsVector RotationalVelocity
408 { 421 {
409 get { return PhysicsVector.Zero; } 422 get { return PhysicsVector.Zero; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index de09691..f2906cf 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -605,6 +605,12 @@ namespace OpenSim.Region.Physics.OdePlugin
605 } 605 }
606 } 606 }
607 607
608 public override PhysicsVector Torque
609 {
610 get { return PhysicsVector.Zero; }
611 set { return; }
612 }
613
608 public override float CollisionScore 614 public override float CollisionScore
609 { 615 {
610 get { return 0f; } 616 get { return 0f; }
@@ -665,6 +671,11 @@ namespace OpenSim.Region.Physics.OdePlugin
665 //m_lastUpdateSent = false; 671 //m_lastUpdateSent = false;
666 } 672 }
667 673
674 public override void AddAngularForce(PhysicsVector force, bool pushforce)
675 {
676
677 }
678
668 /// <summary> 679 /// <summary>
669 /// After all of the forces add up with 'add force' we apply them with doForce 680 /// After all of the forces add up with 'add force' we apply them with doForce
670 /// </summary> 681 /// </summary>
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index eeef893..6f5abfa 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Region.Physics.OdePlugin
47 47
48 public PhysicsVector _position; 48 public PhysicsVector _position;
49 private PhysicsVector _velocity; 49 private PhysicsVector _velocity;
50 private PhysicsVector _torque = new PhysicsVector(0,0,0);
50 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); 51 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
51 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); 52 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
52 private PhysicsVector m_rotationalVelocity; 53 private PhysicsVector m_rotationalVelocity;
@@ -56,7 +57,8 @@ namespace OpenSim.Region.Physics.OdePlugin
56 private Quaternion _orientation; 57 private Quaternion _orientation;
57 private PhysicsVector m_taintposition; 58 private PhysicsVector m_taintposition;
58 private PhysicsVector m_taintsize; 59 private PhysicsVector m_taintsize;
59 private PhysicsVector m_taintVelocity = PhysicsVector.Zero; 60 private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
61 private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
60 private Quaternion m_taintrot; 62 private Quaternion m_taintrot;
61 private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); 63 private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
62 private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); 64 private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
@@ -102,8 +104,10 @@ namespace OpenSim.Region.Physics.OdePlugin
102 private CollisionLocker ode; 104 private CollisionLocker ode;
103 105
104 private bool m_taintforce = false; 106 private bool m_taintforce = false;
107 private bool m_taintaddangularforce = false;
105 private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); 108 private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
106 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); 109 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
110 private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
107 111
108 private IMesh _mesh; 112 private IMesh _mesh;
109 private PrimitiveBaseShape _pbs; 113 private PrimitiveBaseShape _pbs;
@@ -838,6 +842,12 @@ namespace OpenSim.Region.Physics.OdePlugin
838 if (m_taintforce) 842 if (m_taintforce)
839 changeAddForce(timestep); 843 changeAddForce(timestep);
840 844
845 if (m_taintaddangularforce)
846 changeAddAngularForce(timestep);
847
848 if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
849 changeSetTorque(timestep);
850
841 if (m_taintdisable) 851 if (m_taintdisable)
842 changedisable(timestep); 852 changedisable(timestep);
843 853
@@ -2058,6 +2068,49 @@ namespace OpenSim.Region.Physics.OdePlugin
2058 2068
2059 } 2069 }
2060 2070
2071
2072
2073 public void changeSetTorque(float timestamp)
2074 {
2075 if (!m_isSelected)
2076 {
2077 if (IsPhysical && Body != IntPtr.Zero)
2078 {
2079 d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
2080 }
2081 }
2082
2083 m_taintTorque = new PhysicsVector(0, 0, 0);
2084 }
2085
2086 public void changeAddAngularForce(float timestamp)
2087 {
2088 if (!m_isSelected)
2089 {
2090 lock (m_angularforcelist)
2091 {
2092 //m_log.Info("[PHYSICS]: dequeing forcelist");
2093 if (IsPhysical)
2094 {
2095 PhysicsVector iforce = new PhysicsVector();
2096 for (int i = 0; i < m_angularforcelist.Count; i++)
2097 {
2098 iforce = iforce + (m_angularforcelist[i] * 100);
2099 }
2100 d.BodyEnable(Body);
2101 d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z);
2102
2103 }
2104 m_angularforcelist.Clear();
2105 }
2106
2107 m_collisionscore = 0;
2108 m_interpenetrationcount = 0;
2109 }
2110
2111 m_taintaddangularforce = false;
2112 }
2113
2061 private void changevelocity(float timestep) 2114 private void changevelocity(float timestep)
2062 { 2115 {
2063 if (!m_isSelected) 2116 if (!m_isSelected)
@@ -2070,7 +2123,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2070 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); 2123 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
2071 } 2124 }
2072 } 2125 }
2073 2126
2074 //resetCollisionAccounting(); 2127 //resetCollisionAccounting();
2075 } 2128 }
2076 m_taintVelocity = PhysicsVector.Zero; 2129 m_taintVelocity = PhysicsVector.Zero;
@@ -2216,6 +2269,23 @@ namespace OpenSim.Region.Physics.OdePlugin
2216 } 2269 }
2217 } 2270 }
2218 2271
2272 public override PhysicsVector Torque
2273 {
2274 get
2275 {
2276 if (!m_isphysical || Body == IntPtr.Zero)
2277 return new PhysicsVector(0,0,0);
2278
2279 return _torque;
2280 }
2281
2282 set
2283 {
2284 m_taintTorque = value;
2285 _parent_scene.AddPhysicsActorTaint(this);
2286 }
2287 }
2288
2219 public override float CollisionScore 2289 public override float CollisionScore
2220 { 2290 {
2221 get { return m_collisionscore; } 2291 get { return m_collisionscore; }
@@ -2252,6 +2322,12 @@ namespace OpenSim.Region.Physics.OdePlugin
2252 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); 2322 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
2253 } 2323 }
2254 2324
2325 public override void AddAngularForce(PhysicsVector force, bool pushforce)
2326 {
2327 m_angularforcelist.Add(force);
2328 m_taintaddangularforce = true;
2329 }
2330
2255 public override PhysicsVector RotationalVelocity 2331 public override PhysicsVector RotationalVelocity
2256 { 2332 {
2257 get 2333 get
@@ -2323,7 +2399,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2323 d.Quaternion ori = d.BodyGetQuaternion(Body); 2399 d.Quaternion ori = d.BodyGetQuaternion(Body);
2324 d.Vector3 vel = d.BodyGetLinearVel(Body); 2400 d.Vector3 vel = d.BodyGetLinearVel(Body);
2325 d.Vector3 rotvel = d.BodyGetAngularVel(Body); 2401 d.Vector3 rotvel = d.BodyGetAngularVel(Body);
2326 2402 d.Vector3 torque = d.BodyGetTorque(Body);
2403 _torque.setValues(torque.X, torque.Y, torque.Z);
2327 PhysicsVector l_position = new PhysicsVector(); 2404 PhysicsVector l_position = new PhysicsVector();
2328 2405
2329 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 2406 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index ab66d4c..4230a57 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -211,6 +211,12 @@ namespace OpenSim.Region.Physics.POSPlugin
211 set { _target_velocity = value; } 211 set { _target_velocity = value; }
212 } 212 }
213 213
214 public override PhysicsVector Torque
215 {
216 get { return PhysicsVector.Zero; }
217 set { return; }
218 }
219
214 public override float CollisionScore 220 public override float CollisionScore
215 { 221 {
216 get { return 0f; } 222 get { return 0f; }
@@ -255,6 +261,10 @@ namespace OpenSim.Region.Physics.POSPlugin
255 { 261 {
256 } 262 }
257 263
264 public override void AddAngularForce(PhysicsVector force, bool pushforce)
265 {
266 }
267
258 public override void SetMomentum(PhysicsVector momentum) 268 public override void SetMomentum(PhysicsVector momentum)
259 { 269 {
260 } 270 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index fdd095f..bf96c35 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -211,6 +211,16 @@ namespace OpenSim.Region.Physics.POSPlugin
211 { 211 {
212 } 212 }
213 213
214 public override void AddAngularForce(PhysicsVector force, bool pushforce)
215 {
216 }
217
218 public override PhysicsVector Torque
219 {
220 get { return PhysicsVector.Zero; }
221 set { return; }
222 }
223
214 public override void SetMomentum(PhysicsVector momentum) 224 public override void SetMomentum(PhysicsVector momentum)
215 { 225 {
216 } 226 }
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 940c9bc..6502827 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -417,6 +417,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
417 public override void AddForce(PhysicsVector force, bool pushforce) 417 public override void AddForce(PhysicsVector force, bool pushforce)
418 { 418 {
419 } 419 }
420 public override PhysicsVector Torque
421 {
422 get { return PhysicsVector.Zero; }
423 set { return; }
424 }
425 public override void AddAngularForce(PhysicsVector force, bool pushforce)
426 {
427 }
420 428
421 public override void link(PhysicsActor obj) 429 public override void link(PhysicsActor obj)
422 { 430 {
@@ -625,6 +633,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
625 set { _velocity = value; } 633 set { _velocity = value; }
626 } 634 }
627 635
636 public override PhysicsVector Torque
637 {
638 get { return PhysicsVector.Zero; }
639 set { return; }
640 }
641
628 public override float CollisionScore 642 public override float CollisionScore
629 { 643 {
630 get { return 0f; } 644 get { return 0f; }
@@ -666,6 +680,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
666 { 680 {
667 } 681 }
668 682
683 public override void AddAngularForce(PhysicsVector force, bool pushforce)
684 {
685 }
686
669 public override void SetMomentum(PhysicsVector momentum) 687 public override void SetMomentum(PhysicsVector momentum)
670 { 688 {
671 } 689 }