aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-11-29 02:41:32 +0000
committerJustin Clark-Casey (justincc)2013-11-29 02:41:32 +0000
commitca079c378a442f58da1df155916480591a7fb082 (patch)
tree7f90295c2e8ba65824c522b84e93f60a9ae2e2c2
parentAdd parameter checking for land_collision, land_collision_start and land_coll... (diff)
parentFix regression where sitting on ground stopped working. (diff)
downloadopensim-SC_OLD-ca079c378a442f58da1df155916480591a7fb082.zip
opensim-SC_OLD-ca079c378a442f58da1df155916480591a7fb082.tar.gz
opensim-SC_OLD-ca079c378a442f58da1df155916480591a7fb082.tar.bz2
opensim-SC_OLD-ca079c378a442f58da1df155916480591a7fb082.tar.xz
Merge branch 'link-sitting'
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs109
2 files changed, 111 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 20bc59c..8592650 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5079,6 +5079,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5079 { 5079 {
5080 ScenePresence presence = (ScenePresence)entity; 5080 ScenePresence presence = (ScenePresence)entity;
5081 5081
5082// m_log.DebugFormat(
5083// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
5084
5082 attachPoint = presence.State; 5085 attachPoint = presence.State;
5083 collisionPlane = presence.CollisionPlane; 5086 collisionPlane = presence.CollisionPlane;
5084 position = presence.OffsetPosition; 5087 position = presence.OffsetPosition;
@@ -5198,6 +5201,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5198 5201
5199 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 5202 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
5200 { 5203 {
5204// m_log.DebugFormat(
5205// "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name);
5206
5201 byte[] objectData = new byte[76]; 5207 byte[] objectData = new byte[76];
5202 5208
5203 data.CollisionPlane.ToBytes(objectData, 0); 5209 data.CollisionPlane.ToBytes(objectData, 0);
@@ -5218,7 +5224,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5218 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + 5224 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
5219 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); 5225 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
5220 update.ObjectData = objectData; 5226 update.ObjectData = objectData;
5221 update.ParentID = data.ParentID; 5227
5228 SceneObjectPart parentPart = data.ParentPart;
5229 if (parentPart != null)
5230 update.ParentID = parentPart.ParentGroup.LocalId;
5231 else
5232 update.ParentID = 0;
5233
5222 update.PathCurve = 16; 5234 update.PathCurve = 16;
5223 update.PathScaleX = 100; 5235 update.PathScaleX = 100;
5224 update.PathScaleY = 100; 5236 update.PathScaleY = 100;
@@ -12643,6 +12655,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12643 { 12655 {
12644 if (p is ScenePresence) 12656 if (p is ScenePresence)
12645 { 12657 {
12658// m_log.DebugFormat(
12659// "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}",
12660// p.Name, Name, Scene.Name);
12661
12646 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities 12662 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
12647 // There's no explicit message to send the client to tell it to stop flying.. it relies on the 12663 // There's no explicit message to send the client to tell it to stop flying.. it relies on the
12648 // velocity, collision plane and avatar height 12664 // velocity, collision plane and avatar height
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7243db1..0fb5477 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
@@ -522,7 +523,7 @@ namespace OpenSim.Region.Framework.Scenes
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)
@@ -2173,13 +2174,12 @@ namespace OpenSim.Region.Framework.Scenes
2173 { 2174 {
2174// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); 2175// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
2175 2176
2177 bool satOnObject = IsSatOnObject;
2178 SceneObjectPart part = ParentPart;
2176 SitGround = false; 2179 SitGround = false;
2177 if (PhysicsActor == null)
2178 AddToPhysicalScene(false);
2179 2180
2180 if (ParentID != 0) 2181 if (satOnObject)
2181 { 2182 {
2182 SceneObjectPart part = ParentPart;
2183 TaskInventoryDictionary taskIDict = part.TaskInventory; 2183 TaskInventoryDictionary taskIDict = part.TaskInventory;
2184 if (taskIDict != null) 2184 if (taskIDict != null)
2185 { 2185 {
@@ -2198,18 +2198,62 @@ namespace OpenSim.Region.Framework.Scenes
2198 ParentPosition = part.GetWorldPosition(); 2198 ParentPosition = part.GetWorldPosition();
2199 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 2199 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
2200 2200
2201 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
2202 ParentPosition = Vector3.Zero;
2203
2204 ParentID = 0; 2201 ParentID = 0;
2205 ParentPart = null; 2202 ParentPart = null;
2203
2204 Quaternion standRotation;
2205
2206 if (part.SitTargetAvatar == UUID)
2207 {
2208 standRotation = part.GetWorldRotation();
2209
2210 if (!part.IsRoot)
2211 standRotation = standRotation * part.SitTargetOrientation;
2212// standRotation = part.RotationOffset * part.SitTargetOrientation;
2213// else
2214// standRotation = part.SitTargetOrientation;
2215
2216 }
2217 else
2218 {
2219 standRotation = Rotation;
2220 }
2221
2222 //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
2223 //Vector3 standPos = ParentPosition;
2224
2225// Vector3 standPositionAdjustment
2226// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
2227 Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation();
2228
2229 // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
2230 // hardcoding here.
2231 Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;
2232
2233 Vector3 standPos = ParentPosition + adjustmentForSitPosition + adjustmentForSitPose;
2234
2235 m_log.DebugFormat(
2236 "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}",
2237 standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name);
2238
2239 Rotation = standRotation;
2240 AbsolutePosition = standPos;
2241 ParentPosition = Vector3.Zero;
2242 }
2243
2244 // We need to wait until we have calculated proper stand positions before sitting up the physical
2245 // avatar to avoid race conditions.
2246 if (PhysicsActor == null)
2247 AddToPhysicalScene(false);
2248
2249 if (satOnObject)
2250 {
2206 SendAvatarDataToAllAgents(); 2251 SendAvatarDataToAllAgents();
2207 m_requestedSitTargetID = 0; 2252 m_requestedSitTargetID = 0;
2208 2253
2209 part.RemoveSittingAvatar(UUID); 2254 part.RemoveSittingAvatar(UUID);
2210 2255
2211 if (part != null) 2256 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2212 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2213 } 2257 }
2214 2258
2215 Animator.TrySetMovementAnimation("STAND"); 2259 Animator.TrySetMovementAnimation("STAND");
@@ -2267,7 +2311,6 @@ namespace OpenSim.Region.Framework.Scenes
2267 m_sitAvatarHeight = PhysicsActor.Size.Z; 2311 m_sitAvatarHeight = PhysicsActor.Size.Z;
2268 2312
2269 bool canSit = false; 2313 bool canSit = false;
2270 Vector3 pos = part.AbsolutePosition + offset;
2271 2314
2272 if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) 2315 if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
2273 { 2316 {
@@ -2277,10 +2320,23 @@ namespace OpenSim.Region.Framework.Scenes
2277 2320
2278 offset = part.SitTargetPosition; 2321 offset = part.SitTargetPosition;
2279 sitOrientation = part.SitTargetOrientation; 2322 sitOrientation = part.SitTargetOrientation;
2323
2324 if (!part.IsRoot)
2325 {
2326 // m_log.DebugFormat("Old sit orient {0}", sitOrientation);
2327 sitOrientation = part.RotationOffset * sitOrientation;
2328 // m_log.DebugFormat("New sit orient {0}", sitOrientation);
2329// m_log.DebugFormat("Old sit offset {0}", offset);
2330 offset = offset * part.RotationOffset;
2331// m_log.DebugFormat("New sit offset {0}", offset);
2332 }
2333
2280 canSit = true; 2334 canSit = true;
2281 } 2335 }
2282 else 2336 else
2283 { 2337 {
2338 Vector3 pos = part.AbsolutePosition + offset;
2339
2284 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) 2340 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
2285 { 2341 {
2286// m_log.DebugFormat( 2342// m_log.DebugFormat(
@@ -2312,8 +2368,12 @@ namespace OpenSim.Region.Framework.Scenes
2312 cameraEyeOffset = part.GetCameraEyeOffset(); 2368 cameraEyeOffset = part.GetCameraEyeOffset();
2313 forceMouselook = part.GetForceMouselook(); 2369 forceMouselook = part.GetForceMouselook();
2314 2370
2371 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
2372 // being sat upon.
2373 offset += part.OffsetPosition;
2374
2315 ControllingClient.SendSitResponse( 2375 ControllingClient.SendSitResponse(
2316 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2376 part.ParentGroup.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
2317 2377
2318 m_requestedSitTargetUUID = part.UUID; 2378 m_requestedSitTargetUUID = part.UUID;
2319 2379
@@ -2586,13 +2646,31 @@ namespace OpenSim.Region.Framework.Scenes
2586 2646
2587 //Quaternion result = (sitTargetOrient * vq) * nq; 2647 //Quaternion result = (sitTargetOrient * vq) * nq;
2588 2648
2589 m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; 2649 Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT;
2590 Rotation = sitTargetOrient; 2650 Quaternion newRot;
2651
2652 if (part.IsRoot)
2653 {
2654 newRot = sitTargetOrient;
2655 }
2656 else
2657 {
2658 newPos = newPos * part.RotationOffset;
2659 newRot = part.RotationOffset * sitTargetOrient;
2660 }
2661
2662 newPos += part.OffsetPosition;
2663
2664 m_pos = newPos;
2665 Rotation = newRot;
2591 ParentPosition = part.AbsolutePosition; 2666 ParentPosition = part.AbsolutePosition;
2592 } 2667 }
2593 else 2668 else
2594 { 2669 {
2595 m_pos -= part.AbsolutePosition; 2670 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
2671 // being sat upon.
2672 m_pos -= part.GroupPosition;
2673
2596 ParentPosition = part.AbsolutePosition; 2674 ParentPosition = part.AbsolutePosition;
2597 2675
2598// m_log.DebugFormat( 2676// m_log.DebugFormat(
@@ -2825,6 +2903,7 @@ namespace OpenSim.Region.Framework.Scenes
2825 lastTerseUpdateToAllClientsTick = currentTick; 2903 lastTerseUpdateToAllClientsTick = currentTick;
2826 lastPositionSentToAllClients = OffsetPosition; 2904 lastPositionSentToAllClients = OffsetPosition;
2827 2905
2906// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
2828 m_scene.ForEachClient(SendTerseUpdateToClient); 2907 m_scene.ForEachClient(SendTerseUpdateToClient);
2829 } 2908 }
2830 TriggerScenePresenceUpdated(); 2909 TriggerScenePresenceUpdated();