diff options
author | Jeff Ames | 2008-05-19 04:14:43 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-19 04:14:43 +0000 |
commit | dfe8e2c50276a4b79bb4aa565209a71c8ac6d42e (patch) | |
tree | 94621c6e22cdbfed4e16c7dab5aa2849b66255e7 /OpenSim/Region/Environment/Scenes | |
parent | * Committing a change to our build script to generate doxygen documentation w... (diff) | |
download | opensim-SC_OLD-dfe8e2c50276a4b79bb4aa565209a71c8ac6d42e.zip opensim-SC_OLD-dfe8e2c50276a4b79bb4aa565209a71c8ac6d42e.tar.gz opensim-SC_OLD-dfe8e2c50276a4b79bb4aa565209a71c8ac6d42e.tar.bz2 opensim-SC_OLD-dfe8e2c50276a4b79bb4aa565209a71c8ac6d42e.tar.xz |
Rework some of the animation logic in an attempt to resolve #1318
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 63 |
1 files changed, 25 insertions, 38 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 93ec138..8ad3de6 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -873,25 +873,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
873 | // Cause the avatar to stop flying if it's colliding | 873 | // Cause the avatar to stop flying if it's colliding |
874 | // with something with the down arrow pressed. | 874 | // with something with the down arrow pressed. |
875 | 875 | ||
876 | // Skip if there's no physicsactor | 876 | // Only do this if we're flying |
877 | if (m_physicsActor != null) | 877 | if (m_physicsActor != null && m_physicsActor.Flying) |
878 | { | 878 | { |
879 | // Only do this if we're flying | 879 | // Are the landing controls requirements filled? |
880 | if (m_physicsActor.Flying) | 880 | bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
881 | { | 881 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
882 | // Are the landing controls requirements filled? | ||
883 | bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | ||
884 | ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | ||
885 | |||
886 | // Are the collision requirements fulfilled? | ||
887 | bool colliding = (m_physicsActor.IsColliding == true); | ||
888 | |||
889 | 882 | ||
883 | // Are the collision requirements fulfilled? | ||
884 | bool colliding = (m_physicsActor.IsColliding == true); | ||
890 | 885 | ||
891 | if (m_physicsActor.Flying && colliding && controlland) | 886 | if (m_physicsActor.Flying && colliding && controlland) |
892 | { | 887 | { |
893 | StopFlying(); | 888 | StopFlying(); |
894 | } | ||
895 | } | 889 | } |
896 | } | 890 | } |
897 | 891 | ||
@@ -949,10 +943,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
949 | 943 | ||
950 | private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) | 944 | private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) |
951 | { | 945 | { |
952 | |||
953 | |||
954 | |||
955 | |||
956 | bool autopilot = true; | 946 | bool autopilot = true; |
957 | LLVector3 pos = new LLVector3(); | 947 | LLVector3 pos = new LLVector3(); |
958 | LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); | 948 | LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); |
@@ -1181,21 +1171,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1181 | if (m_movementflag != 0) | 1171 | if (m_movementflag != 0) |
1182 | { | 1172 | { |
1183 | // We are moving | 1173 | // We are moving |
1184 | if (m_physicsActor.Flying) | 1174 | if (PhysicsActor != null && PhysicsActor.Flying) |
1185 | { | 1175 | { |
1186 | return "FLY"; | 1176 | return "FLY"; |
1187 | } | 1177 | } |
1188 | else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | 1178 | else if (PhysicsActor != null && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 && |
1189 | PhysicsActor.IsColliding) | 1179 | PhysicsActor.IsColliding) |
1190 | { | 1180 | { |
1191 | return "CROUCHWALK"; | 1181 | return "CROUCHWALK"; |
1192 | } | 1182 | } |
1193 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6) | 1183 | else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6) |
1194 | { | 1184 | { |
1195 | // Client is moving and falling at a velocity greater then 6 meters per unit | ||
1196 | return "FALLDOWN"; | 1185 | return "FALLDOWN"; |
1197 | } | 1186 | } |
1198 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && | 1187 | else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 && |
1199 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | 1188 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) |
1200 | { | 1189 | { |
1201 | return "JUMP"; | 1190 | return "JUMP"; |
@@ -1212,23 +1201,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1212 | else | 1201 | else |
1213 | { | 1202 | { |
1214 | // Not moving | 1203 | // Not moving |
1215 | 1204 | if (PhysicsActor != null && PhysicsActor.IsColliding) | |
1216 | if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | ||
1217 | PhysicsActor.IsColliding) | ||
1218 | { | 1205 | { |
1219 | return "CROUCH"; | 1206 | return "CROUCH"; |
1220 | } | 1207 | } |
1221 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying) | 1208 | else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6 && !PhysicsActor.Flying) |
1222 | { | 1209 | { |
1223 | return "FALLDOWN"; | 1210 | return "FALLDOWN"; |
1224 | } | 1211 | } |
1225 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && | 1212 | else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 && !PhysicsActor.Flying) |
1226 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | ||
1227 | { | 1213 | { |
1228 | // This is the standing jump | 1214 | // This is the standing jump |
1229 | return "JUMP"; | 1215 | return "JUMP"; |
1230 | } | 1216 | } |
1231 | else if (m_physicsActor.Flying) | 1217 | else if (PhysicsActor != null && PhysicsActor.Flying) |
1232 | { | 1218 | { |
1233 | return "HOVER"; | 1219 | return "HOVER"; |
1234 | } | 1220 | } |
@@ -1962,6 +1948,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1962 | Health = health; | 1948 | Health = health; |
1963 | ControllingClient.SendHealth(Health); | 1949 | ControllingClient.SendHealth(Health); |
1964 | } | 1950 | } |
1951 | |||
1965 | internal void Close() | 1952 | internal void Close() |
1966 | { | 1953 | { |
1967 | lock (m_attachments) | 1954 | lock (m_attachments) |
@@ -2009,6 +1996,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2009 | DefaultTexture = textu.ToBytes(); | 1996 | DefaultTexture = textu.ToBytes(); |
2010 | } | 1997 | } |
2011 | } | 1998 | } |
1999 | |||
2012 | public void AddAttachment(SceneObjectGroup gobj) | 2000 | public void AddAttachment(SceneObjectGroup gobj) |
2013 | { | 2001 | { |
2014 | lock (m_attachments) | 2002 | lock (m_attachments) |
@@ -2016,6 +2004,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2016 | m_attachments.Add(gobj); | 2004 | m_attachments.Add(gobj); |
2017 | } | 2005 | } |
2018 | } | 2006 | } |
2007 | |||
2019 | public void RemoveAttachment(SceneObjectGroup gobj) | 2008 | public void RemoveAttachment(SceneObjectGroup gobj) |
2020 | { | 2009 | { |
2021 | lock (m_attachments) | 2010 | lock (m_attachments) |
@@ -2026,6 +2015,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2026 | } | 2015 | } |
2027 | } | 2016 | } |
2028 | } | 2017 | } |
2018 | |||
2029 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | 2019 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) |
2030 | { | 2020 | { |
2031 | lock (m_attachments) | 2021 | lock (m_attachments) |
@@ -2045,8 +2035,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2045 | } | 2035 | } |
2046 | m_attachments.Clear(); | 2036 | m_attachments.Clear(); |
2047 | } | 2037 | } |
2048 | |||
2049 | } | 2038 | } |
2039 | |||
2050 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | 2040 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) |
2051 | { | 2041 | { |
2052 | m_controllingClient = client; | 2042 | m_controllingClient = client; |
@@ -2390,7 +2380,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2390 | 2380 | ||
2391 | public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID) | 2381 | public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID) |
2392 | { | 2382 | { |
2393 | |||
2394 | ScriptControllers obj = new ScriptControllers(); | 2383 | ScriptControllers obj = new ScriptControllers(); |
2395 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; | 2384 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; |
2396 | obj.eventControls = ScriptControlled.CONTROL_ZERO; | 2385 | obj.eventControls = ScriptControlled.CONTROL_ZERO; |
@@ -2439,9 +2428,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2439 | } | 2428 | } |
2440 | } | 2429 | } |
2441 | ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); | 2430 | ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); |
2442 | |||
2443 | |||
2444 | } | 2431 | } |
2432 | |||
2445 | public void HandleForceReleaseControls(IClientAPI remoteClient, LLUUID agentID) | 2433 | public void HandleForceReleaseControls(IClientAPI remoteClient, LLUUID agentID) |
2446 | { | 2434 | { |
2447 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | 2435 | IgnoredControls = ScriptControlled.CONTROL_ZERO; |
@@ -2537,7 +2525,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2537 | change |= DCF; | 2525 | change |= DCF; |
2538 | continue; | 2526 | continue; |
2539 | } | 2527 | } |
2540 | |||
2541 | } | 2528 | } |
2542 | 2529 | ||
2543 | lock (scriptedcontrols) | 2530 | lock (scriptedcontrols) |
@@ -2555,8 +2542,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2555 | } | 2542 | } |
2556 | } | 2543 | } |
2557 | LastCommands = allflags; | 2544 | LastCommands = allflags; |
2558 | |||
2559 | } | 2545 | } |
2546 | |||
2560 | internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored) | 2547 | internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored) |
2561 | { | 2548 | { |
2562 | if (Ignored == ScriptControlled.CONTROL_ZERO) | 2549 | if (Ignored == ScriptControlled.CONTROL_ZERO) |