aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-12 23:46:26 +0000
committerTeravus Ovares2007-11-12 23:46:26 +0000
commitd9d35f9fd7141d8f7a5b3b056cae051d6de2efd5 (patch)
tree37a49b26a6cb07d1fdc3e419222ea2147eaa089e /OpenSim
parent* Added a lot of Glue to help with reporting proper collisions. (diff)
downloadopensim-SC_OLD-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.zip
opensim-SC_OLD-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.tar.gz
opensim-SC_OLD-d9d35f9fd7141d8f7a5b3b056cae051d6de2efd5.tar.bz2
opensim-SC_OLD-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')
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs1
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs19
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs1
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs7
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs27
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs10
10 files changed, 80 insertions, 6 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index a7238fd..5d7bdd4 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -184,6 +184,7 @@ namespace OpenSim.Framework
184 public delegate void DisconnectUser(); 184 public delegate void DisconnectUser();
185 185
186 public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); 186 public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
187 public delegate void SetAlwaysRun (IClientAPI remoteClient, bool SetAlwaysRun);
187 188
188 public delegate void GenericCall2(); 189 public delegate void GenericCall2();
189 190
@@ -293,7 +294,7 @@ namespace OpenSim.Framework
293 event TeleportLocationRequest OnTeleportLocationRequest; 294 event TeleportLocationRequest OnTeleportLocationRequest;
294 event DisconnectUser OnDisconnectUser; 295 event DisconnectUser OnDisconnectUser;
295 event RequestAvatarProperties OnRequestAvatarProperties; 296 event RequestAvatarProperties OnRequestAvatarProperties;
296 297 event SetAlwaysRun OnSetAlwaysRun;
297 event GenericCall4 OnDeRezObject; 298 event GenericCall4 OnDeRezObject;
298 event Action<IClientAPI> OnRegionHandShakeReply; 299 event Action<IClientAPI> OnRegionHandShakeReply;
299 event GenericCall2 OnRequestWearables; 300 event GenericCall2 OnRequestWearables;
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index b52a834..b18a844 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Region.ClientStack
84 public event TeleportLocationRequest OnTeleportLocationRequest; 84 public event TeleportLocationRequest OnTeleportLocationRequest;
85 public event DisconnectUser OnDisconnectUser; 85 public event DisconnectUser OnDisconnectUser;
86 public event RequestAvatarProperties OnRequestAvatarProperties; 86 public event RequestAvatarProperties OnRequestAvatarProperties;
87 public event SetAlwaysRun OnSetAlwaysRun;
87 88
88 public event CreateNewInventoryItem OnCreateNewInventoryItem; 89 public event CreateNewInventoryItem OnCreateNewInventoryItem;
89 public event CreateInventoryFolder OnCreateNewInventoryFolder; 90 public event CreateInventoryFolder OnCreateNewInventoryFolder;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 978f34e..f941d6c 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -169,6 +169,13 @@ namespace OpenSim.Region.ClientStack
169 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); 169 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
170 } 170 }
171 break; 171 break;
172 case PacketType.SetAlwaysRun:
173 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
174
175 if (OnSetAlwaysRun != null)
176 OnSetAlwaysRun(this,run.AgentData.AlwaysRun);
177
178 break;
172 case PacketType.CompleteAgentMovement: 179 case PacketType.CompleteAgentMovement:
173 if (OnCompleteMovementToRegion != null) 180 if (OnCompleteMovementToRegion != null)
174 { 181 {
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 5d643d1..307dec7 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
55 private bool m_oldColliding = true; 55 private bool m_oldColliding = true;
56 56
57 private bool m_isTyping = false; 57 private bool m_isTyping = false;
58 private bool m_setAlwaysRun = false;
58 59
59 private Quaternion m_bodyRot; 60 private Quaternion m_bodyRot;
60 private byte[] m_visualParams; 61 private byte[] m_visualParams;
@@ -271,6 +272,7 @@ namespace OpenSim.Region.Environment.Scenes
271 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 272 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
272 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; 273 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
273 m_controllingClient.OnAgentSit += HandleAgentSit; 274 m_controllingClient.OnAgentSit += HandleAgentSit;
275 m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
274 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 276 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
275 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 277 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
276 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 278 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -637,7 +639,15 @@ namespace OpenSim.Region.Environment.Scenes
637 SendAnimPack(Animations.AnimsLLUUID["SIT"], 1); 639 SendAnimPack(Animations.AnimsLLUUID["SIT"], 1);
638 SendFullUpdateToAllClients(); 640 SendFullUpdateToAllClients();
639 } 641 }
642 public void HandleSetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun)
643 {
644 m_setAlwaysRun = SetAlwaysRun;
645 if (PhysicsActor != null)
646 {
647 PhysicsActor.SetAlwaysRun = SetAlwaysRun;
648 }
640 649
650 }
641 protected void UpdateMovementAnimations(bool update_movementflag) 651 protected void UpdateMovementAnimations(bool update_movementflag)
642 { 652 {
643 if (update_movementflag) 653 if (update_movementflag)
@@ -667,7 +677,14 @@ namespace OpenSim.Region.Environment.Scenes
667 } 677 }
668 else 678 else
669 { 679 {
670 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); 680 if (!m_setAlwaysRun)
681 {
682 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
683 }
684 else
685 {
686 SendAnimPack(Animations.AnimsLLUUID["RUN"], 1);
687 }
671 } 688 }
672 } 689 }
673 } 690 }
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 717b6c0..474f6fd 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -61,6 +61,7 @@ namespace SimpleApp
61 public event TeleportLocationRequest OnTeleportLocationRequest; 61 public event TeleportLocationRequest OnTeleportLocationRequest;
62 public event DisconnectUser OnDisconnectUser; 62 public event DisconnectUser OnDisconnectUser;
63 public event RequestAvatarProperties OnRequestAvatarProperties; 63 public event RequestAvatarProperties OnRequestAvatarProperties;
64 public event SetAlwaysRun OnSetAlwaysRun;
64 65
65 public event GenericCall4 OnDeRezObject; 66 public event GenericCall4 OnDeRezObject;
66 public event Action<IClientAPI> OnRegionHandShakeReply; 67 public event Action<IClientAPI> OnRegionHandShakeReply;
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 3283ec0..2582097 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -206,6 +206,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
206 get { return m_rotationalVelocity; } 206 get { return m_rotationalVelocity; }
207 set { m_rotationalVelocity = value; } 207 set { m_rotationalVelocity = value; }
208 } 208 }
209 public override bool SetAlwaysRun
210 {
211 get { return false; }
212 set { return; }
213 }
209 public override bool IsPhysical 214 public override bool IsPhysical
210 { 215 {
211 get { return false; } 216 get { return false; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index b51f024..f78e99e 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -764,7 +764,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
764 return; 764 return;
765 } 765 }
766 } 766 }
767 767 public override bool SetAlwaysRun
768 {
769 get { return false; }
770 set { return; }
771 }
768 public override PhysicsVector Acceleration 772 public override PhysicsVector Acceleration
769 { 773 {
770 get { return _acceleration; } 774 get { return _acceleration; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 49760da..84b451f 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.Manager
153 public abstract bool IsPhysical {get; set;} 153 public abstract bool IsPhysical {get; set;}
154 154
155 public abstract bool Flying { get; set; } 155 public abstract bool Flying { get; set; }
156 156 public abstract bool SetAlwaysRun { get; set; }
157 public abstract bool ThrottleUpdates { get; set; } 157 public abstract bool ThrottleUpdates { get; set; }
158 158
159 public abstract bool IsColliding { get; set; } 159 public abstract bool IsColliding { get; set; }
@@ -176,6 +176,11 @@ namespace OpenSim.Region.Physics.Manager
176 get { return PhysicsVector.Zero; } 176 get { return PhysicsVector.Zero; }
177 set { return; } 177 set { return; }
178 } 178 }
179 public override bool SetAlwaysRun
180 {
181 get { return false; }
182 set { return; }
183 }
179 public override bool CollidingGround 184 public override bool CollidingGround
180 { 185 {
181 get {return false;} 186 get {return false;}
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
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 1396458..4805d79 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -209,6 +209,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
209 get { return (int)ActorTypes.Agent; } 209 get { return (int)ActorTypes.Agent; }
210 set { return; } 210 set { return; }
211 } 211 }
212 public override bool SetAlwaysRun
213 {
214 get { return false; }
215 set { return; }
216 }
212 public override bool IsPhysical 217 public override bool IsPhysical
213 { 218 {
214 get { return false; } 219 get { return false; }
@@ -363,6 +368,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
363 get { return false; } 368 get { return false; }
364 set { return; } 369 set { return; }
365 } 370 }
371 public override bool SetAlwaysRun
372 {
373 get { return false; }
374 set { return; }
375 }
366 public override bool ThrottleUpdates 376 public override bool ThrottleUpdates
367 { 377 {
368 get { return false; } 378 get { return false; }