aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-06-15 14:01:18 +0100
committerUbitUmarov2012-06-15 14:10:16 +0100
commitdb2dcbbe2d02bee0fdaab9a3b209c98dc690b976 (patch)
tree01bf98ba77c6361a2bc42818fee0189fd7a53d0a /OpenSim/Region
parent Add sop IsPhysical and IsPhantom to be used gradually in core in place of as... (diff)
downloadopensim-SC-db2dcbbe2d02bee0fdaab9a3b209c98dc690b976.zip
opensim-SC-db2dcbbe2d02bee0fdaab9a3b209c98dc690b976.tar.gz
opensim-SC-db2dcbbe2d02bee0fdaab9a3b209c98dc690b976.tar.bz2
opensim-SC-db2dcbbe2d02bee0fdaab9a3b209c98dc690b976.tar.xz
SL doesn't let scripts rotate root part of physical linksets also fix sitting avatars rotations broken in previus commit, forcing send of updates.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs43
1 files changed, 27 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a37c68e..b507937 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2337,13 +2337,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2337 // (root prim). ParentID may be nonzero in attachments and 2337 // (root prim). ParentID may be nonzero in attachments and
2338 // using it would cause attachments and HUDs to rotate 2338 // using it would cause attachments and HUDs to rotate
2339 // to the wrong positions. 2339 // to the wrong positions.
2340
2340 SetRot(m_host, Rot2Quaternion(rot)); 2341 SetRot(m_host, Rot2Quaternion(rot));
2341 } 2342 }
2342 else 2343 else
2343 { 2344 {
2344 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 2345 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
2345 SceneObjectPart rootPart = m_host.ParentGroup.RootPart; 2346 SceneObjectPart rootPart;// = m_host.ParentGroup.RootPart;
2346 if (rootPart != null) // better safe than sorry 2347 if (m_host.ParentGroup != null && ((rootPart = m_host.ParentGroup.RootPart) != null)) // better safe than sorry
2347 { 2348 {
2348 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); 2349 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2349 } 2350 }
@@ -2355,6 +2356,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2355 public void llSetLocalRot(LSL_Rotation rot) 2356 public void llSetLocalRot(LSL_Rotation rot)
2356 { 2357 {
2357 m_host.AddScriptLPS(1); 2358 m_host.AddScriptLPS(1);
2359
2358 SetRot(m_host, Rot2Quaternion(rot)); 2360 SetRot(m_host, Rot2Quaternion(rot));
2359 ScriptSleep(200); 2361 ScriptSleep(200);
2360 } 2362 }
@@ -2364,25 +2366,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2364 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 2366 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
2365 return; 2367 return;
2366 2368
2367 part.UpdateRotation(rot); 2369 bool isroot = (part == part.ParentGroup.RootPart);
2368 // Update rotation does not move the object in the physics scene if it's a linkset.
2369 2370
2370//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type 2371 // SL doesn't let scripts rotate root of physical linksets
2371// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 2372 if (isroot && part.IsPhysical)
2373 return;
2374
2375 part.UpdateRotation(rot);
2372 2376
2373 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line 2377 // Update rotation does not move the object in the physics scene if it's a linkset.
2374 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt 2378 // so do a nasty update
2375 // It's perfectly okay when the object is not an active physical body though. 2379 // but only root part rotation changes positions and only needed if we have physics actor
2376 // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against 2380 if (isroot && part.PhysActor != null)
2377 // but only if the object is not physial and active. This is important for rotating doors.
2378 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
2379 // scene
2380 PhysicsActor pa = part.PhysActor;
2381 // only root part rot changes positions
2382 if (pa != null && !pa.IsPhysical && part == part.ParentGroup.RootPart)
2383 { 2381 {
2384 part.ParentGroup.ResetChildPrimPhysicsPositions(); 2382 part.ParentGroup.ResetChildPrimPhysicsPositions();
2385 } 2383 }
2384 else // fix sitting avatars
2385 {
2386 List<ScenePresence> sittingavas = part.ParentGroup.GetLinkedAvatars();
2387 if (sittingavas.Count > 0)
2388 {
2389 foreach (ScenePresence av in sittingavas)
2390 {
2391 if (isroot || part.LocalId == av.ParentID)
2392 av.SendAvatarDataToAllAgents();
2393 }
2394 }
2395 }
2386 } 2396 }
2387 2397
2388 /// <summary> 2398 /// <summary>
@@ -8544,6 +8554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8544 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8554 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8545 if (remain < 1) 8555 if (remain < 1)
8546 return; 8556 return;
8557
8547 LSL_Rotation lr = rules.GetQuaternionItem(idx++); 8558 LSL_Rotation lr = rules.GetQuaternionItem(idx++);
8548 SetRot(part, Rot2Quaternion(lr)); 8559 SetRot(part, Rot2Quaternion(lr));
8549 break; 8560 break;