diff options
author | Justin Clark-Casey (justincc) | 2013-11-27 02:08:22 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-11-27 02:08:22 +0000 |
commit | 0785210e29c75b09084321dca0569c9e4b73f858 (patch) | |
tree | 2ed2c7661b66b7c3bc50f76db9950621fcfef233 /OpenSim/Region | |
parent | Only translate linked prim specified offset pos by the link prim rotation, no... (diff) | |
download | opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.zip opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.gz opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.bz2 opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.xz |
Fix stand positions rather than having the stand jump to the root prim.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 56 |
2 files changed, 59 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1ac9d7f..c1aae3f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5076,6 +5076,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5076 | { | 5076 | { |
5077 | ScenePresence presence = (ScenePresence)entity; | 5077 | ScenePresence presence = (ScenePresence)entity; |
5078 | 5078 | ||
5079 | // m_log.DebugFormat( | ||
5080 | // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); | ||
5081 | |||
5079 | attachPoint = presence.State; | 5082 | attachPoint = presence.State; |
5080 | collisionPlane = presence.CollisionPlane; | 5083 | collisionPlane = presence.CollisionPlane; |
5081 | position = presence.OffsetPosition; | 5084 | position = presence.OffsetPosition; |
@@ -5195,6 +5198,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5195 | 5198 | ||
5196 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5199 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5197 | { | 5200 | { |
5201 | // m_log.DebugFormat( | ||
5202 | // "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name); | ||
5203 | |||
5198 | byte[] objectData = new byte[76]; | 5204 | byte[] objectData = new byte[76]; |
5199 | 5205 | ||
5200 | data.CollisionPlane.ToBytes(objectData, 0); | 5206 | data.CollisionPlane.ToBytes(objectData, 0); |
@@ -12646,6 +12652,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12646 | { | 12652 | { |
12647 | if (p is ScenePresence) | 12653 | if (p is ScenePresence) |
12648 | { | 12654 | { |
12655 | // m_log.DebugFormat( | ||
12656 | // "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}", | ||
12657 | // p.Name, Name, Scene.Name); | ||
12658 | |||
12649 | // It turns out to get the agent to stop flying, you have to feed it stop flying velocities | 12659 | // It turns out to get the agent to stop flying, you have to feed it stop flying velocities |
12650 | // There's no explicit message to send the client to tell it to stop flying.. it relies on the | 12660 | // There's no explicit message to send the client to tell it to stop flying.. it relies on the |
12651 | // velocity, collision plane and avatar height | 12661 | // velocity, collision plane and avatar height |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a73d140..f9b598f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -499,6 +499,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
499 | } | 499 | } |
500 | else | 500 | else |
501 | { | 501 | { |
502 | // m_log.DebugFormat("[SCENE PRESENCE]: Fetching abs pos where PhysicsActor == null and parent part {0} for {1}", Name, Scene.Name); | ||
502 | // Obtain the correct position of a seated avatar. | 503 | // Obtain the correct position of a seated avatar. |
503 | // In addition to providing the correct position while | 504 | // In addition to providing the correct position while |
504 | // the avatar is seated, this value will also | 505 | // the avatar is seated, this value will also |
@@ -515,14 +516,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
515 | SceneObjectPart sitPart = ParentPart; | 516 | SceneObjectPart sitPart = ParentPart; |
516 | 517 | ||
517 | if (sitPart != null) | 518 | if (sitPart != null) |
518 | return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); | 519 | return sitPart.AbsolutePosition; |
519 | } | 520 | } |
520 | 521 | ||
521 | return m_pos; | 522 | return m_pos; |
522 | } | 523 | } |
523 | set | 524 | set |
524 | { | 525 | { |
525 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} in {1} to {2}", Name, Scene.Name, value); | 526 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} to {1} in {2}", Name, value, Scene.Name); |
526 | // Util.PrintCallStack(); | 527 | // Util.PrintCallStack(); |
527 | 528 | ||
528 | if (PhysicsActor != null) | 529 | if (PhysicsActor != null) |
@@ -2174,8 +2175,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2174 | // m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); | 2175 | // m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); |
2175 | 2176 | ||
2176 | SitGround = false; | 2177 | SitGround = false; |
2177 | if (PhysicsActor == null) | ||
2178 | AddToPhysicalScene(false); | ||
2179 | 2178 | ||
2180 | if (ParentID != 0) | 2179 | if (ParentID != 0) |
2181 | { | 2180 | { |
@@ -2198,11 +2197,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
2198 | ParentPosition = part.GetWorldPosition(); | 2197 | ParentPosition = part.GetWorldPosition(); |
2199 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 2198 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
2200 | 2199 | ||
2201 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | ||
2202 | ParentPosition = Vector3.Zero; | ||
2203 | |||
2204 | ParentID = 0; | 2200 | ParentID = 0; |
2205 | ParentPart = null; | 2201 | ParentPart = null; |
2202 | |||
2203 | Quaternion standRotation; | ||
2204 | |||
2205 | if (part.SitTargetAvatar == UUID) | ||
2206 | { | ||
2207 | standRotation = part.GetWorldRotation(); | ||
2208 | |||
2209 | if (!part.IsRoot) | ||
2210 | standRotation = standRotation * part.SitTargetOrientation; | ||
2211 | // standRotation = part.RotationOffset * part.SitTargetOrientation; | ||
2212 | // else | ||
2213 | // standRotation = part.SitTargetOrientation; | ||
2214 | |||
2215 | } | ||
2216 | else | ||
2217 | { | ||
2218 | standRotation = Rotation; | ||
2219 | } | ||
2220 | |||
2221 | //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | ||
2222 | //Vector3 standPos = ParentPosition; | ||
2223 | |||
2224 | // Vector3 standPositionAdjustment | ||
2225 | // = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); | ||
2226 | Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation(); | ||
2227 | |||
2228 | // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than | ||
2229 | // hardcoding here. | ||
2230 | Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation; | ||
2231 | |||
2232 | Vector3 standPos = ParentPosition + adjustmentForSitPosition + adjustmentForSitPose; | ||
2233 | |||
2234 | m_log.DebugFormat( | ||
2235 | "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}", | ||
2236 | standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name); | ||
2237 | |||
2238 | Rotation = standRotation; | ||
2239 | AbsolutePosition = standPos; | ||
2240 | ParentPosition = Vector3.Zero; | ||
2241 | |||
2242 | // We need to wait until we have calculated proper stand positions before sitting up the physical | ||
2243 | // avatar to avoid race conditions. | ||
2244 | if (PhysicsActor == null) | ||
2245 | AddToPhysicalScene(false); | ||
2246 | |||
2206 | SendAvatarDataToAllAgents(); | 2247 | SendAvatarDataToAllAgents(); |
2207 | m_requestedSitTargetID = 0; | 2248 | m_requestedSitTargetID = 0; |
2208 | 2249 | ||
@@ -2859,6 +2900,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2859 | lastTerseUpdateToAllClientsTick = currentTick; | 2900 | lastTerseUpdateToAllClientsTick = currentTick; |
2860 | lastPositionSentToAllClients = OffsetPosition; | 2901 | lastPositionSentToAllClients = OffsetPosition; |
2861 | 2902 | ||
2903 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); | ||
2862 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2904 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2863 | } | 2905 | } |
2864 | TriggerScenePresenceUpdated(); | 2906 | TriggerScenePresenceUpdated(); |