diff options
author | Teravus Ovares | 2007-11-12 23:46:26 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-12 23:46:26 +0000 |
commit | d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5 (patch) | |
tree | 37a49b26a6cb07d1fdc3e419222ea2147eaa089e /OpenSim/Region/Physics/OdePlugin | |
parent | * Added a lot of Glue to help with reporting proper collisions. (diff) | |
download | opensim-SC-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.zip opensim-SC-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.tar.gz opensim-SC-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.tar.bz2 opensim-SC-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.tar.xz |
* Implemented Walk Vs Run in ODE. Also helps make the walk look smoother.
* All thanks to unimplemented packet listing :D
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index c93b96f..b528b9b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -660,6 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
660 | private bool flying = false; | 660 | private bool flying = false; |
661 | private bool m_iscolliding = false; | 661 | private bool m_iscolliding = false; |
662 | private bool m_wascolliding = false; | 662 | private bool m_wascolliding = false; |
663 | private bool m_alwaysRun = false; | ||
663 | 664 | ||
664 | private bool[] m_colliderarr = new bool[11]; | 665 | private bool[] m_colliderarr = new bool[11]; |
665 | 666 | ||
@@ -702,6 +703,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
702 | get { return (int)ActorTypes.Agent; } | 703 | get { return (int)ActorTypes.Agent; } |
703 | set { return; } | 704 | set { return; } |
704 | } | 705 | } |
706 | public override bool SetAlwaysRun | ||
707 | { | ||
708 | get { return m_alwaysRun; } | ||
709 | set { m_alwaysRun = value;} | ||
710 | } | ||
705 | public override bool IsPhysical | 711 | public override bool IsPhysical |
706 | { | 712 | { |
707 | get { return false; } | 713 | get { return false; } |
@@ -876,6 +882,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
876 | // no lock; for now it's only called from within Simulate() | 882 | // no lock; for now it's only called from within Simulate() |
877 | PhysicsVector vec = new PhysicsVector(); | 883 | PhysicsVector vec = new PhysicsVector(); |
878 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 884 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
885 | float movementdivisor = 1f; | ||
886 | |||
887 | if (!m_alwaysRun) | ||
888 | { | ||
889 | movementdivisor = 10.5f; | ||
890 | } | ||
891 | else | ||
892 | { | ||
893 | movementdivisor = 0.2079f; | ||
894 | |||
895 | } | ||
879 | 896 | ||
880 | // if velocity is zero, use position control; otherwise, velocity control | 897 | // if velocity is zero, use position control; otherwise, velocity control |
881 | if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f && m_iscolliding) | 898 | if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f && m_iscolliding) |
@@ -900,8 +917,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
900 | _zeroFlag = false; | 917 | _zeroFlag = false; |
901 | if (m_iscolliding || flying) | 918 | if (m_iscolliding || flying) |
902 | { | 919 | { |
903 | vec.X = (_target_velocity.X - vel.X) * PID_D; | 920 | |
904 | vec.Y = (_target_velocity.Y - vel.Y) * PID_D; | 921 | vec.X = ((_target_velocity.X - vel.X)/movementdivisor) * PID_D; |
922 | vec.Y = ((_target_velocity.Y - vel.Y)/movementdivisor) * PID_D; | ||
905 | } | 923 | } |
906 | if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) | 924 | if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) |
907 | { | 925 | { |
@@ -1077,6 +1095,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1077 | get { return (int)ActorTypes.Prim; } | 1095 | get { return (int)ActorTypes.Prim; } |
1078 | set { return; } | 1096 | set { return; } |
1079 | } | 1097 | } |
1098 | public override bool SetAlwaysRun | ||
1099 | { | ||
1100 | get { return false; } | ||
1101 | set { return; } | ||
1102 | } | ||
1080 | public void enableBody() | 1103 | public void enableBody() |
1081 | { | 1104 | { |
1082 | // Sets the geom to a body | 1105 | // Sets the geom to a body |