aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs7
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs9
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs54
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs14
5 files changed, 76 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 46037df..d5cb99f 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -181,6 +181,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
181 private PhysicsVector _position; 181 private PhysicsVector _position;
182 private PhysicsVector _velocity; 182 private PhysicsVector _velocity;
183 private PhysicsVector _acceleration; 183 private PhysicsVector _acceleration;
184 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
184 private bool flying; 185 private bool flying;
185 private bool iscolliding; 186 private bool iscolliding;
186 187
@@ -190,7 +191,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
190 _position = new PhysicsVector(); 191 _position = new PhysicsVector();
191 _acceleration = new PhysicsVector(); 192 _acceleration = new PhysicsVector();
192 } 193 }
193 194 public override PhysicsVector RotationalVelocity
195 {
196 get { return m_rotationalVelocity; }
197 set { m_rotationalVelocity = value; }
198 }
194 public override bool IsPhysical 199 public override bool IsPhysical
195 { 200 {
196 get { return false; } 201 get { return false; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index efc99e4..cdccc70 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -643,6 +643,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
643 protected PhysicsVector _size; 643 protected PhysicsVector _size;
644 protected PhysicsVector _acceleration; 644 protected PhysicsVector _acceleration;
645 protected AxiomQuaternion _orientation; 645 protected AxiomQuaternion _orientation;
646 protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
646 protected RigidBody rigidBody; 647 protected RigidBody rigidBody;
647 private Boolean iscolliding = false; 648 private Boolean iscolliding = false;
648 649
@@ -662,6 +663,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
662 } 663 }
663 } 664 }
664 } 665 }
666 public override PhysicsVector RotationalVelocity
667 {
668 get { return m_rotationalVelocity; }
669 set { m_rotationalVelocity = value; }
670 }
665 public override PhysicsVector Velocity 671 public override PhysicsVector Velocity
666 { 672 {
667 get { return _velocity; } 673 get { return _velocity; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index b151e16..2d8eb9a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager
36 36
37 public delegate void OrientationUpdate(Quaternion orientation); 37 public delegate void OrientationUpdate(Quaternion orientation);
38 38
39
40
39 public abstract class PhysicsActor 41 public abstract class PhysicsActor
40 { 42 {
41#pragma warning disable 67 43#pragma warning disable 67
@@ -69,6 +71,7 @@ namespace OpenSim.Region.Physics.Manager
69 public abstract bool Flying { get; set; } 71 public abstract bool Flying { get; set; }
70 72
71 public abstract bool IsColliding { get; set; } 73 public abstract bool IsColliding { get; set; }
74 public abstract PhysicsVector RotationalVelocity { get; set; }
72 75
73 public abstract bool Kinematic { get; set; } 76 public abstract bool Kinematic { get; set; }
74 77
@@ -144,7 +147,11 @@ namespace OpenSim.Region.Physics.Manager
144 { 147 {
145 return; 148 return;
146 } 149 }
147 150 public override PhysicsVector RotationalVelocity
151 {
152 get { return PhysicsVector.Zero; }
153 set { return; }
154 }
148 public override void SetMomentum(PhysicsVector momentum) 155 public override void SetMomentum(PhysicsVector momentum)
149 { 156 {
150 return; 157 return;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 8b8aac6..512b96e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -617,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin
617 private PhysicsVector _velocity; 617 private PhysicsVector _velocity;
618 private PhysicsVector _target_velocity; 618 private PhysicsVector _target_velocity;
619 private PhysicsVector _acceleration; 619 private PhysicsVector _acceleration;
620 private PhysicsVector m_rotationalVelocity;
620 private static float PID_D = 4000.0f; 621 private static float PID_D = 4000.0f;
621 private static float PID_P = 7000.0f; 622 private static float PID_P = 7000.0f;
622 private static float POSTURE_SERVO = 10000.0f; 623 private static float POSTURE_SERVO = 10000.0f;
@@ -682,7 +683,11 @@ namespace OpenSim.Region.Physics.OdePlugin
682 } 683 }
683 } 684 }
684 } 685 }
685 686 public override PhysicsVector RotationalVelocity
687 {
688 get { return m_rotationalVelocity; }
689 set { m_rotationalVelocity = value; }
690 }
686 public override PhysicsVector Size 691 public override PhysicsVector Size
687 { 692 {
688 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } 693 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
@@ -858,6 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin
858 private PhysicsVector _velocity; 863 private PhysicsVector _velocity;
859 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f); 864 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f);
860 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); 865 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
866 private PhysicsVector m_rotationalVelocity;
861 private PhysicsVector _size; 867 private PhysicsVector _size;
862 private PhysicsVector _acceleration; 868 private PhysicsVector _acceleration;
863 public Quaternion _orientation; 869 public Quaternion _orientation;
@@ -887,6 +893,7 @@ namespace OpenSim.Region.Physics.OdePlugin
887 _position = pos; 893 _position = pos;
888 _size = size; 894 _size = size;
889 _acceleration = new PhysicsVector(); 895 _acceleration = new PhysicsVector();
896 m_rotationalVelocity = PhysicsVector.Zero;
890 _orientation = rotation; 897 _orientation = rotation;
891 _mesh = mesh; 898 _mesh = mesh;
892 _pbs = pbs; 899 _pbs = pbs;
@@ -1224,7 +1231,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1224 } 1231 }
1225 public void Move(float timestep) 1232 public void Move(float timestep)
1226 { 1233 {
1227 1234
1235 }
1236 public override PhysicsVector RotationalVelocity
1237 {
1238 get{ return m_rotationalVelocity;}
1239 set { m_rotationalVelocity = value; }
1228 } 1240 }
1229 1241
1230 public void UpdatePositionAndVelocity() { 1242 public void UpdatePositionAndVelocity() {
@@ -1234,6 +1246,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1234 d.Vector3 vec = d.BodyGetPosition(Body); 1246 d.Vector3 vec = d.BodyGetPosition(Body);
1235 d.Quaternion ori = d.BodyGetQuaternion(Body); 1247 d.Quaternion ori = d.BodyGetQuaternion(Body);
1236 d.Vector3 vel = d.BodyGetLinearVel(Body); 1248 d.Vector3 vel = d.BodyGetLinearVel(Body);
1249 d.Vector3 rotvel = d.BodyGetAngularVel(Body);
1250
1237 PhysicsVector l_position = new PhysicsVector(); 1251 PhysicsVector l_position = new PhysicsVector();
1238 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1252 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1239 if (vec.X < 0.0f) vec.X = 0.0f; 1253 if (vec.X < 0.0f) vec.X = 0.0f;
@@ -1256,7 +1270,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1256 try 1270 try
1257 { 1271 {
1258 disableBody(); 1272 disableBody();
1259 1273
1260 } 1274 }
1261 catch (System.Exception e) 1275 catch (System.Exception e)
1262 { 1276 {
@@ -1264,13 +1278,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1264 { 1278 {
1265 d.BodyDestroy(Body); 1279 d.BodyDestroy(Body);
1266 Body = (IntPtr)0; 1280 Body = (IntPtr)0;
1267 1281
1268 } 1282 }
1269 } 1283 }
1270 IsPhysical = false; 1284 IsPhysical = false;
1271 _velocity.X = 0; 1285 _velocity.X = 0;
1272 _velocity.Y = 0; 1286 _velocity.Y = 0;
1273 _velocity.Z = 0; 1287 _velocity.Z = 0;
1288 m_rotationalVelocity.X = 0;
1289 m_rotationalVelocity.Y = 0;
1290 m_rotationalVelocity.Z = 0;
1274 _zeroFlag = true; 1291 _zeroFlag = true;
1275 } 1292 }
1276 1293
@@ -1293,11 +1310,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1293 _velocity.X = 0.0f; 1310 _velocity.X = 0.0f;
1294 _velocity.Y = 0.0f; 1311 _velocity.Y = 0.0f;
1295 _velocity.Z = 0.0f; 1312 _velocity.Z = 0.0f;
1296 _orientation.w = 0f; 1313 //_orientation.w = 0f;
1297 _orientation.x = 0f; 1314 //_orientation.x = 0f;
1298 _orientation.y = 0f; 1315 //_orientation.y = 0f;
1299 _orientation.z = 0f; 1316 //_orientation.z = 0f;
1300 1317 m_rotationalVelocity.X = 0;
1318 m_rotationalVelocity.Y = 0;
1319 m_rotationalVelocity.Z = 0;
1301 1320
1302 } 1321 }
1303 else 1322 else
@@ -1310,6 +1329,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1310 _velocity.Y = vel.Y; 1329 _velocity.Y = vel.Y;
1311 _velocity.Z = vel.Z; 1330 _velocity.Z = vel.Z;
1312 1331
1332 m_rotationalVelocity.X = rotvel.X;
1333 m_rotationalVelocity.Y = rotvel.Y;
1334 m_rotationalVelocity.Z = rotvel.Z;
1335 //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString());
1313 _orientation.w = ori.W; 1336 _orientation.w = ori.W;
1314 _orientation.x = ori.X; 1337 _orientation.x = ori.X;
1315 _orientation.y = ori.Y; 1338 _orientation.y = ori.Y;
@@ -1317,6 +1340,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1317 } 1340 }
1318 1341
1319 } 1342 }
1343 else
1344 {
1345 // Not a body.. so Make sure the client isn't interpolating
1346 _velocity.X = 0;
1347 _velocity.Y = 0;
1348 _velocity.Z = 0;
1349 m_rotationalVelocity.X = 0;
1350 m_rotationalVelocity.Y = 0;
1351 m_rotationalVelocity.Z = 0;
1352 _zeroFlag = true;
1353 }
1320 1354
1321 } 1355 }
1322 public override void SetMomentum(PhysicsVector momentum) 1356 public override void SetMomentum(PhysicsVector momentum)
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 5483703..d282e9d 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -184,6 +184,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
184 { 184 {
185 private PhysicsVector _position; 185 private PhysicsVector _position;
186 private PhysicsVector _velocity; 186 private PhysicsVector _velocity;
187 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
187 private PhysicsVector _acceleration; 188 private PhysicsVector _acceleration;
188 private NxCharacter _character; 189 private NxCharacter _character;
189 private bool flying; 190 private bool flying;
@@ -214,7 +215,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
214 get { return iscolliding; } 215 get { return iscolliding; }
215 set { iscolliding = value; } 216 set { iscolliding = value; }
216 } 217 }
217 218 public override PhysicsVector RotationalVelocity
219 {
220 get { return m_rotationalVelocity; }
221 set { m_rotationalVelocity = value; }
222 }
218 public override PhysicsVector Position 223 public override PhysicsVector Position
219 { 224 {
220 get { return _position; } 225 get { return _position; }
@@ -314,6 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
314 private PhysicsVector _position; 319 private PhysicsVector _position;
315 private PhysicsVector _velocity; 320 private PhysicsVector _velocity;
316 private PhysicsVector _acceleration; 321 private PhysicsVector _acceleration;
322 private PhysicsVector m_rotationalVelocity;
317 private NxActor _prim; 323 private NxActor _prim;
318 324
319 public PhysXPrim(NxActor prim) 325 public PhysXPrim(NxActor prim)
@@ -329,7 +335,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
329 get { return false; } 335 get { return false; }
330 set { return; } 336 set { return; }
331 } 337 }
332 338 public override PhysicsVector RotationalVelocity
339 {
340 get { return m_rotationalVelocity; }
341 set { m_rotationalVelocity = value; }
342 }
333 public override bool Flying 343 public override bool Flying
334 { 344 {
335 get { return false; //no flying prims for you 345 get { return false; //no flying prims for you