aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-17 14:59:05 +0000
committerTeravus Ovares2008-01-17 14:59:05 +0000
commit18c959df12983256d73240a86fa0bad12c4e36ce (patch)
treed85ef34d3196461f8d3dd0ae653b37912f098a7e /OpenSim/Region/Physics
parent* added ForEachPart helper (diff)
downloadopensim-SC-18c959df12983256d73240a86fa0bad12c4e36ce.zip
opensim-SC-18c959df12983256d73240a86fa0bad12c4e36ce.tar.gz
opensim-SC-18c959df12983256d73240a86fa0bad12c4e36ce.tar.bz2
opensim-SC-18c959df12983256d73240a86fa0bad12c4e36ce.tar.xz
* Added llApplyImpulse in the global frame. The object must be physical before this'll do anything. Be careful with this function as it's easy to loose prim.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 6d08f98..bf88fc4 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
30using Axiom.Math; 31using Axiom.Math;
31using Ode.NET; 32using Ode.NET;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -51,6 +52,9 @@ namespace OpenSim.Region.Physics.OdePlugin
51 private bool m_taintPhysics = false; 52 private bool m_taintPhysics = false;
52 public bool m_taintremove = false; 53 public bool m_taintremove = false;
53 54
55 private bool m_taintforce = false;
56 private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
57
54 private IMesh _mesh; 58 private IMesh _mesh;
55 private PrimitiveBaseShape _pbs; 59 private PrimitiveBaseShape _pbs;
56 private OdeScene _parent_scene; 60 private OdeScene _parent_scene;
@@ -355,6 +359,9 @@ namespace OpenSim.Region.Physics.OdePlugin
355 if (m_taintshape) 359 if (m_taintshape)
356 changeshape(timestep); 360 changeshape(timestep);
357 // 361 //
362
363 if (m_taintforce)
364 changeAddForce(timestep);
358 } 365 }
359 366
360 public void Move(float timestep) 367 public void Move(float timestep)
@@ -541,6 +548,27 @@ namespace OpenSim.Region.Physics.OdePlugin
541 m_taintshape = false; 548 m_taintshape = false;
542 } 549 }
543 550
551 public void changeAddForce(float timestamp)
552 {
553 lock (m_forcelist)
554 {
555 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "dequeing forcelist");
556 if (IsPhysical)
557 {
558 PhysicsVector iforce = new PhysicsVector();
559 for (int i = 0; i < m_forcelist.Count; i++)
560 {
561 iforce = iforce + (m_forcelist[i]*100);
562 }
563 d.BodyEnable(Body);
564 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
565 }
566 m_forcelist.Clear();
567 }
568 m_taintforce = false;
569
570 }
571
544 public override bool IsPhysical 572 public override bool IsPhysical
545 { 573 {
546 get { return m_isphysical; } 574 get { return m_isphysical; }
@@ -663,6 +691,9 @@ namespace OpenSim.Region.Physics.OdePlugin
663 691
664 public override void AddForce(PhysicsVector force) 692 public override void AddForce(PhysicsVector force)
665 { 693 {
694 m_forcelist.Add(force);
695 m_taintforce = true;
696 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Added Force:" + force.ToString() + " to prim at " + Position.ToString());
666 } 697 }
667 698
668 public override PhysicsVector RotationalVelocity 699 public override PhysicsVector RotationalVelocity