aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBrian McBee2007-08-18 23:05:02 +0000
committerBrian McBee2007-08-18 23:05:02 +0000
commit318376707de4f5406958239eac069f24ef8ef62a (patch)
tree8bf85a1e61f15cf0d7775af1aa4cb461d0c1bfc7
parentAdded (theoretical) AppDomain cleanup code. (diff)
downloadopensim-SC-318376707de4f5406958239eac069f24ef8ef62a.zip
opensim-SC-318376707de4f5406958239eac069f24ef8ef62a.tar.gz
opensim-SC-318376707de4f5406958239eac069f24ef8ef62a.tar.bz2
opensim-SC-318376707de4f5406958239eac069f24ef8ef62a.tar.xz
starting to add bits and pieces to physics prims that we will eventually need for collisions. not hooked in yet.
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs35
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs2
4 files changed, 33 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 6732d98..a990318 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
90 90
91 } 91 }
92 92
93 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 93 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
94 { 94 {
95 return null; 95 return null;
96 } 96 }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index fb6358a..0e75b04 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28using OpenSim.Framework.Console; 28using OpenSim.Framework.Console;
29using Axiom.Math;
29 30
30namespace OpenSim.Physics.Manager 31namespace OpenSim.Physics.Manager
31{ 32{
@@ -43,7 +44,7 @@ namespace OpenSim.Physics.Manager
43 44
44 public abstract void RemoveAvatar(PhysicsActor actor); 45 public abstract void RemoveAvatar(PhysicsActor actor);
45 46
46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); 47 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation);
47 48
48 public abstract void Simulate(float timeStep); 49 public abstract void Simulate(float timeStep);
49 50
@@ -73,7 +74,7 @@ namespace OpenSim.Physics.Manager
73 74
74 } 75 }
75 76
76 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 77 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
77 { 78 {
78 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); 79 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
79 return PhysicsActor.Null; 80 return PhysicsActor.Null;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 4b1d3f0..af79e63 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -80,6 +80,7 @@ namespace OpenSim.Region.Physics.OdePlugin
80 private double[] _heightmap; 80 private double[] _heightmap;
81 static private d.NearCallback nearCallback = near; 81 static private d.NearCallback nearCallback = near;
82 private List<OdeCharacter> _characters = new List<OdeCharacter>(); 82 private List<OdeCharacter> _characters = new List<OdeCharacter>();
83 private List<OdePrim> _prims = new List<OdePrim>();
83 private static d.ContactGeom[] contacts = new d.ContactGeom[30]; 84 private static d.ContactGeom[] contacts = new d.ContactGeom[30];
84 private static d.Contact contact; 85 private static d.Contact contact;
85 86
@@ -134,7 +135,7 @@ namespace OpenSim.Region.Physics.OdePlugin
134 135
135 } 136 }
136 137
137 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 138 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
138 { 139 {
139 PhysicsVector pos = new PhysicsVector(); 140 PhysicsVector pos = new PhysicsVector();
140 pos.X = position.X; 141 pos.X = position.X;
@@ -144,7 +145,14 @@ namespace OpenSim.Region.Physics.OdePlugin
144 siz.X = size.X; 145 siz.X = size.X;
145 siz.Y = size.Y; 146 siz.Y = size.Y;
146 siz.Z = size.Z; 147 siz.Z = size.Z;
147 return new OdePrim(); 148 Quaternion rot = new Quaternion();
149 rot.w = rotation.w;
150 rot.x = rotation.x;
151 rot.y = rotation.y;
152 rot.z = rotation.z;
153 OdePrim newPrim = new OdePrim(this, pos, siz, rot);
154 this._prims.Add(newPrim);
155 return newPrim;
148 } 156 }
149 157
150 public override void Simulate(float timeStep) 158 public override void Simulate(float timeStep)
@@ -347,15 +355,29 @@ namespace OpenSim.Region.Physics.OdePlugin
347 355
348 public class OdePrim : PhysicsActor 356 public class OdePrim : PhysicsActor
349 { 357 {
358
350 private PhysicsVector _position; 359 private PhysicsVector _position;
351 private PhysicsVector _velocity; 360 private PhysicsVector _velocity;
361 private PhysicsVector _size;
352 private PhysicsVector _acceleration; 362 private PhysicsVector _acceleration;
363 private Quaternion _orientation;
364 private IntPtr BoundingCapsule;
365 IntPtr capsule_geom;
366 d.Mass capsule_mass;
353 367
354 public OdePrim() 368 public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation)
355 { 369 {
356 _velocity = new PhysicsVector(); 370 _velocity = new PhysicsVector();
357 _position = new PhysicsVector(); 371 _position = pos;
372 _size = size;
358 _acceleration = new PhysicsVector(); 373 _acceleration = new PhysicsVector();
374 d.MassSetCapsule(out capsule_mass, 50.0f, 3, 0.5f, 2f);
375 capsule_geom = d.CreateBox(OdeScene.space, _size.X, _size.Y, _size.Z);
376 this.BoundingCapsule = d.BodyCreate(OdeScene.world);
377 d.BodySetMass(BoundingCapsule, ref capsule_mass);
378 d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z);
379 d.GeomSetBody(capsule_geom, BoundingCapsule);
380 _orientation = rotation;
359 } 381 }
360 public override bool Flying 382 public override bool Flying
361 { 383 {
@@ -420,12 +442,11 @@ namespace OpenSim.Region.Physics.OdePlugin
420 { 442 {
421 get 443 get
422 { 444 {
423 Quaternion res = new Quaternion(); 445 return _orientation;
424 return res;
425 } 446 }
426 set 447 set
427 { 448 {
428 449 _orientation = value;
429 } 450 }
430 } 451 }
431 452
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 111d436..679d233 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
103 103
104 } 104 }
105 105
106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
107 { 107 {
108 Vec3 pos = new Vec3(); 108 Vec3 pos = new Vec3();
109 pos.X = position.X; 109 pos.X = position.X;