aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs15
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs17
4 files changed, 72 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 6447403..5790591 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -578,6 +578,16 @@ namespace OpenSim.Region.Environment.Scenes
578 SetPartAsRoot(newPart); 578 SetPartAsRoot(newPart);
579 } 579 }
580 580
581 public void applyImpulse(PhysicsVector impulse)
582 {
583 SceneObjectPart rootpart = m_rootPart;
584 if (m_rootPart.PhysActor != null)
585 {
586 m_rootPart.PhysActor.AddForce(impulse);
587 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
588 }
589 }
590
581 public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 591 public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
582 { 592 {
583 part.LastOwnerID = part.OwnerID; 593 part.LastOwnerID = part.OwnerID;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0cb4ae7..ce38bee 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -520,6 +520,21 @@ namespace OpenSim.Region.Environment.Scenes
520 520
521 protected PrimitiveBaseShape m_shape; 521 protected PrimitiveBaseShape m_shape;
522 522
523 /// <summary>
524 /// hook to the physics scene to apply impulse
525 /// This is sent up to the group, which then finds the root prim
526 /// and applies the force on the root prim of the group
527 /// </summary>
528 /// <param name="impulse">Vector force</param>
529 public void ApplyImpulse(LLVector3 impulsei)
530 {
531 PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
532 if (m_parentGroup != null)
533 {
534 m_parentGroup.applyImpulse(impulse);
535 }
536 }
537
523 public void TriggerScriptChangedEvent(Changed val) 538 public void TriggerScriptChangedEvent(Changed val)
524 { 539 {
525 if (m_parentGroup != null) 540 if (m_parentGroup != null)
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
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 1400617..c196322 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -792,7 +792,22 @@ namespace OpenSim.Region.ScriptEngine.Common
792 792
793 public void llApplyImpulse(LSL_Types.Vector3 force, int local) 793 public void llApplyImpulse(LSL_Types.Vector3 force, int local)
794 { 794 {
795 NotImplemented("llApplyImpulse"); 795 //No energy force yet
796 if (local == 1)
797 {
798 NotImplemented("llApplyImpulse Local Force");
799 }
800 else
801 {
802 if (force.x > 20000)
803 force.x = 20000;
804 if (force.y > 20000)
805 force.y = 20000;
806 if (force.z > 20000)
807 force.z = 20000;
808
809 m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z));
810 }
796 } 811 }
797 812
798 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) 813 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local)