diff options
author | Teravus Ovares | 2008-01-17 14:59:05 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-17 14:59:05 +0000 |
commit | 18c959df12983256d73240a86fa0bad12c4e36ce (patch) | |
tree | d85ef34d3196461f8d3dd0ae653b37912f098a7e /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | * added ForEachPart helper (diff) | |
download | opensim-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/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 31 |
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 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
30 | using Axiom.Math; | 31 | using Axiom.Math; |
31 | using Ode.NET; | 32 | using Ode.NET; |
32 | using OpenSim.Framework; | 33 | using 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 |