diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 819d823..5cdbb77 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
49 | private Quaternion _orientation; | 49 | private Quaternion _orientation; |
50 | private PhysicsVector m_taintposition; | 50 | private PhysicsVector m_taintposition; |
51 | private PhysicsVector m_taintsize; | 51 | private PhysicsVector m_taintsize; |
52 | private PhysicsVector m_taintVelocity = PhysicsVector.Zero; | ||
52 | private Quaternion m_taintrot; | 53 | private Quaternion m_taintrot; |
53 | private bool m_taintshape = false; | 54 | private bool m_taintshape = false; |
54 | private bool m_taintPhysics = false; | 55 | private bool m_taintPhysics = false; |
@@ -455,8 +456,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
455 | 456 | ||
456 | if (m_taintdisable) | 457 | if (m_taintdisable) |
457 | changedisable(timestep); | 458 | changedisable(timestep); |
459 | |||
460 | if (m_taintVelocity != PhysicsVector.Zero) | ||
461 | changevelocity(timestep); | ||
458 | } | 462 | } |
459 | 463 | ||
464 | |||
465 | |||
460 | public void Move(float timestep) | 466 | public void Move(float timestep) |
461 | { | 467 | { |
462 | if (m_isphysical) | 468 | if (m_isphysical) |
@@ -743,7 +749,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
743 | m_taintforce = false; | 749 | m_taintforce = false; |
744 | 750 | ||
745 | } | 751 | } |
746 | 752 | private void changevelocity(float timestep) | |
753 | { | ||
754 | System.Threading.Thread.Sleep(20); | ||
755 | if (IsPhysical) | ||
756 | { | ||
757 | if (Body != (IntPtr)0) | ||
758 | { | ||
759 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); | ||
760 | } | ||
761 | } | ||
762 | m_taintVelocity = PhysicsVector.Zero; | ||
763 | } | ||
747 | public override bool IsPhysical | 764 | public override bool IsPhysical |
748 | { | 765 | { |
749 | get { return m_isphysical; } | 766 | get { return m_isphysical; } |
@@ -838,7 +855,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
838 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; | 855 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; |
839 | return returnVelocity; | 856 | return returnVelocity; |
840 | } | 857 | } |
841 | set { _velocity = value; } | 858 | set { |
859 | _velocity = value; | ||
860 | |||
861 | m_taintVelocity = value; | ||
862 | _parent_scene.AddPhysicsActorTaint(this); | ||
863 | |||
864 | |||
865 | } | ||
842 | } | 866 | } |
843 | 867 | ||
844 | public override bool Kinematic | 868 | public override bool Kinematic |
@@ -898,16 +922,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
898 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | 922 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); |
899 | 923 | ||
900 | PhysicsVector l_position = new PhysicsVector(); | 924 | PhysicsVector l_position = new PhysicsVector(); |
925 | |||
926 | |||
901 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 927 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
902 | if (vec.X < 0.0f) vec.X = 0.0f; | 928 | //if (vec.X < 0.0f) vec.X = 0.0f; |
903 | if (vec.Y < 0.0f) vec.Y = 0.0f; | 929 | //if (vec.Y < 0.0f) vec.Y = 0.0f; |
904 | if (vec.X > 255.95f) vec.X = 255.95f; | 930 | //if (vec.X > 255.95f) vec.X = 255.95f; |
905 | if (vec.Y > 255.95f) vec.Y = 255.95f; | 931 | //if (vec.Y > 255.95f) vec.Y = 255.95f; |
906 | m_lastposition = _position; | 932 | m_lastposition = _position; |
907 | 933 | ||
908 | l_position.X = vec.X; | 934 | l_position.X = vec.X; |
909 | l_position.Y = vec.Y; | 935 | l_position.Y = vec.Y; |
910 | l_position.Z = vec.Z; | 936 | l_position.Z = vec.Z; |
937 | |||
938 | if (l_position.X > 257f || l_position.X < -1f || l_position.Y > 257f || l_position.Y < -1f) | ||
939 | { | ||
940 | base.RequestPhysicsterseUpdate(); | ||
941 | } | ||
942 | |||
911 | if (l_position.Z < 0) | 943 | if (l_position.Z < 0) |
912 | { | 944 | { |
913 | // This is so prim that get lost underground don't fall forever and suck up | 945 | // This is so prim that get lost underground don't fall forever and suck up |