aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs55
1 files changed, 39 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 383dbc0..b38eea0 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -23,12 +23,12 @@
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28#region References 28#region References
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Physics.Manager; 31using OpenSim.Region.Physics.Manager;
32using Axiom.Math; 32using Axiom.Math;
33//Specific References for BulletXPlugin 33//Specific References for BulletXPlugin
34using MonoXnaCompactMaths; 34using MonoXnaCompactMaths;
@@ -163,7 +163,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
163 163
164 } 164 }
165 165
166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Axiom.Math.Quaternion rotation)
167 { 167 {
168 PhysicsVector pos = new PhysicsVector(); 168 PhysicsVector pos = new PhysicsVector();
169 pos.X = position.X; 169 pos.X = position.X;
@@ -176,6 +176,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
176 return new BulletXPrim(); 176 return new BulletXPrim();
177 } 177 }
178 178
179 public override void RemovePrim(PhysicsActor prim)
180 {
181 throw new Exception("The method or operation is not implemented.");
182 }
179 public override void Simulate(float timeStep) 183 public override void Simulate(float timeStep)
180 { 184 {
181 foreach (BulletXCharacter actor in _characters) 185 foreach (BulletXCharacter actor in _characters)
@@ -187,7 +191,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
187 foreach (BulletXCharacter actor in _characters) 191 foreach (BulletXCharacter actor in _characters)
188 { 192 {
189 actor.ValidateHeight(this._heightmap[ 193 actor.ValidateHeight(this._heightmap[
190 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256 194 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256
191 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]); 195 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]);
192 } 196 }
193 foreach (BulletXCharacter actor in _characters) 197 foreach (BulletXCharacter actor in _characters)
@@ -257,7 +261,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
257 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f)); 261 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f));
258 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 262 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
259 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 263 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3();
260 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 264 _collisionShape.CalculateLocalInertia(_mass, out _localInertia);
265//Always when mass > 0
261 266
262 //The next values might change 267 //The next values might change
263 float _linearDamping = 0.0f; 268 float _linearDamping = 0.0f;
@@ -283,6 +288,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin
283 } 288 }
284 } 289 }
285 290
291 public override PhysicsVector Size
292 {
293 get
294 {
295 throw new Exception("The method or operation is not implemented.");
296 }
297 set
298 {
299 throw new Exception("The method or operation is not implemented.");
300 }
301 }
302
286 public override PhysicsVector Position 303 public override PhysicsVector Position
287 { 304 {
288 get 305 get
@@ -359,7 +376,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
359 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3(); 376 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3();
360 //if (this._velocity.X == 0.0f) 377 //if (this._velocity.X == 0.0f)
361 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity 378 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity
362 //else 379 //else
363 vec.X = this._velocity.X; //overrides current velocity 380 vec.X = this._velocity.X; //overrides current velocity
364 381
365 //if (this._velocity.Y == 0.0f) 382 //if (this._velocity.Y == 0.0f)
@@ -376,18 +393,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin
376 if (flying) 393 if (flying)
377 { 394 {
378 //Antigravity with movement 395 //Antigravity with movement
379 if (this._position.Z <= BulletXScene.HeightLevel0) 396 if (this._position.Z <= BulletXScene.HeightLevel0)
380 { 397 {
381 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep; 398 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep;
382 } 399 }
383 //Lowgravity with movement 400 //Lowgravity with movement
384 else if((this._position.Z > BulletXScene.HeightLevel0) 401 else if((this._position.Z > BulletXScene.HeightLevel0)
385 && (this._position.Z <= BulletXScene.HeightLevel1)) 402 && (this._position.Z <= BulletXScene.HeightLevel1))
386 { 403 {
387 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 404 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
388 } 405 }
389 //Lowgravity with... 406 //Lowgravity with...
390 else if (this._position.Z > BulletXScene.HeightLevel1) 407 else if (this._position.Z > BulletXScene.HeightLevel1)
391 { 408 {
392 if(nextZVelocity > 0) //no movement 409 if(nextZVelocity > 0) //no movement
393 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 410 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
@@ -447,6 +464,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
447 464
448 } 465 }
449 } 466 }
467 public override PhysicsVector Size
468 {
469 get
470 {
471 throw new Exception("The method or operation is not implemented.");
472 }
473 set
474 {
475 throw new Exception("The method or operation is not implemented.");
476 }
477 }
450 public override PhysicsVector Position 478 public override PhysicsVector Position
451 { 479 {
452 get 480 get
@@ -469,7 +497,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
469 this._prim.Position = pos;*/ 497 this._prim.Position = pos;*/
470 } 498 }
471 } 499 }
472
473 public override PhysicsVector Velocity 500 public override PhysicsVector Velocity
474 { 501 {
475 get 502 get
@@ -481,7 +508,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
481 _velocity = value; 508 _velocity = value;
482 } 509 }
483 } 510 }
484
485 public override bool Kinematic 511 public override bool Kinematic
486 { 512 {
487 get 513 get
@@ -494,7 +520,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
494 //this._prim.Kinematic = value; 520 //this._prim.Kinematic = value;
495 } 521 }
496 } 522 }
497
498 public override Axiom.Math.Quaternion Orientation 523 public override Axiom.Math.Quaternion Orientation
499 { 524 {
500 get 525 get
@@ -507,7 +532,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
507 532
508 } 533 }
509 } 534 }
510
511 public override PhysicsVector Acceleration 535 public override PhysicsVector Acceleration
512 { 536 {
513 get 537 get
@@ -520,15 +544,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
520 { 544 {
521 this._acceleration = accel; 545 this._acceleration = accel;
522 } 546 }
523
524 public override void AddForce(PhysicsVector force) 547 public override void AddForce(PhysicsVector force)
525 { 548 {
526 549
527 } 550 }
528
529 public override void SetMomentum(PhysicsVector momentum) 551 public override void SetMomentum(PhysicsVector momentum)
530 { 552 {
531 553
532 } 554 }
533 } 555 }
534} 556}
557