diff options
author | Brian McBee | 2007-08-18 23:05:02 +0000 |
---|---|---|
committer | Brian McBee | 2007-08-18 23:05:02 +0000 |
commit | 318376707de4f5406958239eac069f24ef8ef62a (patch) | |
tree | 8bf85a1e61f15cf0d7775af1aa4cb461d0c1bfc7 /OpenSim/Region/Physics/OdePlugin | |
parent | Added (theoretical) AppDomain cleanup code. (diff) | |
download | opensim-SC_OLD-318376707de4f5406958239eac069f24ef8ef62a.zip opensim-SC_OLD-318376707de4f5406958239eac069f24ef8ef62a.tar.gz opensim-SC_OLD-318376707de4f5406958239eac069f24ef8ef62a.tar.bz2 opensim-SC_OLD-318376707de4f5406958239eac069f24ef8ef62a.tar.xz |
starting to add bits and pieces to physics prims that we will eventually need for collisions. not hooked in yet.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 35 |
1 files changed, 28 insertions, 7 deletions
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 | ||