aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs111
2 files changed, 86 insertions, 27 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index f1c1f78..83fd775 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -329,7 +329,7 @@ namespace OpenSim.Data.SQLite
329 { 329 {
330 foreach (SceneObjectPart prim in obj.Children.Values) 330 foreach (SceneObjectPart prim in obj.Children.Values)
331 { 331 {
332 m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); 332// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
333 addPrim(prim, obj.UUID, regionUUID); 333 addPrim(prim, obj.UUID, regionUUID);
334 } 334 }
335 } 335 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c553ca0..c67463a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -670,8 +670,7 @@ namespace OpenSim.Region.Framework.Scenes
670 670
671 671
672 AdjustKnownSeeds(); 672 AdjustKnownSeeds();
673 673 Animator.TrySetMovementAnimation("STAND");
674 Animator.TrySetMovementAnimation("STAND");
675 // we created a new ScenePresence (a new child agent) in a fresh region. 674 // we created a new ScenePresence (a new child agent) in a fresh region.
676 // Request info about all the (root) agents in this region 675 // Request info about all the (root) agents in this region
677 // Note: This won't send data *to* other clients in that region (children don't send) 676 // Note: This won't send data *to* other clients in that region (children don't send)
@@ -1660,16 +1659,27 @@ namespace OpenSim.Region.Framework.Scenes
1660 } 1659 }
1661 // part.GetWorldRotation() is the rotation of the object being sat on 1660 // part.GetWorldRotation() is the rotation of the object being sat on
1662 // Rotation is the sittiing Av's rotation 1661 // Rotation is the sittiing Av's rotation
1663 1662
1664 Quaternion wr = Quaternion.Inverse(Quaternion.Inverse(Rotation) * Quaternion.Inverse(part.GetWorldRotation())); // world or. of the av 1663 Quaternion partRot;
1665 Vector3 so = new Vector3(1.0f, 0f, 0f) * wr; // 1M infront of av 1664 if (part.LinkNum == 1)
1666 Vector3 wso = so + part.GetWorldPosition() + ( m_pos * part.GetWorldRotation()); // + av sit offset! 1665 { // Root prim of linkset
1666 partRot = part.ParentGroup.RootPart.RotationOffset;
1667 }
1668 else
1669 { // single or child prim
1670 partRot = part.GetWorldRotation();
1671 }
1672 Quaternion partIRot = Quaternion.Inverse(partRot);
1673
1674 Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
1675 Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av
1676 Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + ( m_pos * partRot); // + av sit offset!
1667 1677
1668 if (m_physicsActor == null) 1678 if (m_physicsActor == null)
1669 { 1679 {
1670 AddToPhysicalScene(false); 1680 AddToPhysicalScene(false);
1671 } 1681 }
1672 AbsolutePosition = wso; //KF: Fix stand up. 1682 AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
1673 m_parentPosition = Vector3.Zero; 1683 m_parentPosition = Vector3.Zero;
1674 m_parentID = 0; 1684 m_parentID = 0;
1675 part.IsOccupied = false; 1685 part.IsOccupied = false;
@@ -1680,7 +1690,6 @@ namespace OpenSim.Region.Framework.Scenes
1680 SetHeight(m_avHeight); 1690 SetHeight(m_avHeight);
1681 } 1691 }
1682 } 1692 }
1683
1684 Animator.TrySetMovementAnimation("STAND"); 1693 Animator.TrySetMovementAnimation("STAND");
1685 } 1694 }
1686 1695
@@ -1752,8 +1761,17 @@ namespace OpenSim.Region.Framework.Scenes
1752 Quaternion avSitOrientation = part.SitTargetOrientation; 1761 Quaternion avSitOrientation = part.SitTargetOrientation;
1753 1762
1754 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored. 1763 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
1755 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); 1764 // Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1756 1765 Quaternion partRot;
1766 if (part.LinkNum == 1)
1767 { // Root prim of linkset
1768 partRot = part.ParentGroup.RootPart.RotationOffset;
1769 }
1770 else
1771 { // single or child prim
1772 partRot = part.GetWorldRotation();
1773 }
1774 Quaternion partIRot = Quaternion.Inverse(partRot);
1757//Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet); 1775//Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet);
1758 // Sit analysis rewritten by KF 091125 1776 // Sit analysis rewritten by KF 091125
1759 if (SitTargetisSet) // scipted sit 1777 if (SitTargetisSet) // scipted sit
@@ -1800,6 +1818,8 @@ namespace OpenSim.Region.Framework.Scenes
1800 cameraAtOffset = part.GetCameraAtOffset(); 1818 cameraAtOffset = part.GetCameraAtOffset();
1801 cameraEyeOffset = part.GetCameraEyeOffset(); 1819 cameraEyeOffset = part.GetCameraEyeOffset();
1802 forceMouselook = part.GetForceMouselook(); 1820 forceMouselook = part.GetForceMouselook();
1821 if(cameraAtOffset == Vector3.Zero) cameraAtOffset = new Vector3(0f, 0f, 0.1f); //
1822 if(cameraEyeOffset == Vector3.Zero) cameraEyeOffset = new Vector3(0f, 0f, 0.1f); //
1803 1823
1804 if (m_physicsActor != null) 1824 if (m_physicsActor != null)
1805 { 1825 {
@@ -1823,7 +1843,29 @@ namespace OpenSim.Region.Framework.Scenes
1823 } 1843 }
1824 else return; // physactor is null! 1844 else return; // physactor is null!
1825 1845
1826 Vector3 offsetr = offset * partIRot; 1846 Vector3 offsetr; // = offset * partIRot;
1847 // KF: In a linkset, offsetr needs to be relative to the group root! 091208
1848 // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot);
1849 if (part.LinkNum < 2)
1850 { // Single, or Root prim of linkset, target is ClickOffset * RootRot
1851 offsetr = offset * partIRot;
1852 }
1853 else
1854 { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot)
1855 offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) +
1856 (offset * partRot);
1857 }
1858
1859//Console.WriteLine(" ");
1860//Console.WriteLine("link number ={0}", part.LinkNum);
1861//Console.WriteLine("Prim offset ={0}", part.OffsetPosition );
1862//Console.WriteLine("Root Rotate ={0}", part.ParentGroup.RootPart.RotationOffset);
1863//Console.WriteLine("Click offst ={0}", offset);
1864//Console.WriteLine("Prim Rotate ={0}", part.GetWorldRotation());
1865//Console.WriteLine("offsetr ={0}", offsetr);
1866//Console.WriteLine("Camera At ={0}", cameraAtOffset);
1867//Console.WriteLine("Camera Eye ={0}", cameraEyeOffset);
1868
1827 ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); 1869 ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
1828 m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target 1870 m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target
1829 // This calls HandleAgentSit twice, once from here, and the client calls 1871 // This calls HandleAgentSit twice, once from here, and the client calls
@@ -2142,13 +2184,20 @@ namespace OpenSim.Region.Framework.Scenes
2142 } 2184 }
2143 else 2185 else
2144 { 2186 {
2145//Console.WriteLine("NON Scripted Sit");
2146 // if m_avUnscriptedSitPos is zero then Av sits above center 2187 // if m_avUnscriptedSitPos is zero then Av sits above center
2147 // Else Av sits at m_avUnscriptedSitPos 2188 // Else Av sits at m_avUnscriptedSitPos
2148 2189
2149 // Non-scripted sit by Kitto Flora 21Nov09 2190 // Non-scripted sit by Kitto Flora 21Nov09
2150 // Calculate angle of line from prim to Av 2191 // Calculate angle of line from prim to Av
2151 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); 2192 Quaternion partIRot;
2193 if (part.LinkNum == 1)
2194 { // Root prim of linkset
2195 partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
2196 }
2197 else
2198 { // single or child prim
2199 partIRot = Quaternion.Inverse(part.GetWorldRotation());
2200 }
2152 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; 2201 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
2153 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); 2202 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
2154 float x_diff = ( m_avInitialPos.X - sitTargetPos.X); 2203 float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
@@ -2167,7 +2216,7 @@ namespace OpenSim.Region.Framework.Scenes
2167 m_avUnscriptedSitPos; // adds click offset, if any 2216 m_avUnscriptedSitPos; // adds click offset, if any
2168 //Set up raytrace to find top surface of prim 2217 //Set up raytrace to find top surface of prim
2169 Vector3 size = part.Scale; 2218 Vector3 size = part.Scale;
2170 float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z)); 2219 float mag = 2.0f; // 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
2171 Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag); 2220 Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
2172 Vector3 down = new Vector3(0f, 0f, -1f); 2221 Vector3 down = new Vector3(0f, 0f, -1f);
2173//Console.WriteLine("st={0} do={1} ma={2}", start, down, mag); 2222//Console.WriteLine("st={0} do={1} ma={2}", start, down, mag);
@@ -2203,11 +2252,21 @@ namespace OpenSim.Region.Framework.Scenes
2203 // collisionPoint = spot on prim where we want to sit 2252 // collisionPoint = spot on prim where we want to sit
2204 // collisionPoint.Z = global sit surface height 2253 // collisionPoint.Z = global sit surface height
2205 SceneObjectPart part = m_scene.GetSceneObjectPart(localid); 2254 SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
2206 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); 2255 Quaternion partIRot;
2256 if (part.LinkNum == 1)
2257 { // Root prim of linkset
2258 partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
2259 }
2260 else
2261 { // single or child prim
2262 partIRot = Quaternion.Inverse(part.GetWorldRotation());
2263 }
2207 float offZ = collisionPoint.Z - m_initialSitTarget.Z; 2264 float offZ = collisionPoint.Z - m_initialSitTarget.Z;
2208 Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction 2265 Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
2209//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); 2266//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);
2210 m_pos += offset; 2267 m_pos += offset;
2268// ControllingClient.SendClearFollowCamProperties(part.UUID);
2269
2211 } 2270 }
2212 } // End SitAltitudeCallback KF. 2271 } // End SitAltitudeCallback KF.
2213 2272
@@ -3236,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes
3236 m_updateflag = true; 3295 m_updateflag = true;
3237 Velocity = force; 3296 Velocity = force;
3238 m_isNudging = false; 3297 m_isNudging = false;
3239 m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND" 3298 m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND"
3240 } 3299 }
3241 } 3300 }
3242 } 3301 }
@@ -3288,19 +3347,19 @@ namespace OpenSim.Region.Framework.Scenes
3288 // Event called by the physics plugin to tell the avatar about a collision. 3347 // Event called by the physics plugin to tell the avatar about a collision.
3289 private void PhysicsCollisionUpdate(EventArgs e) 3348 private void PhysicsCollisionUpdate(EventArgs e)
3290 { 3349 {
3291 if (m_updateCount > 0) //KF: Update Anims for a short period. Many Anim
3292 { // changes are very asynchronous.
3293 Animator.UpdateMovementAnimations();
3294 m_updateCount--;
3295 }
3296
3297 if (e == null) 3350 if (e == null)
3298 return; 3351 return;
3299 3352
3300 // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( 3353 // The Physics Scene will send (spam!) updates every 500 ms grep: m_physicsActor.SubscribeEvents(
3301 // as of this comment the interval is set in AddToPhysicalScene 3354 // as of this comment the interval is set in AddToPhysicalScene
3302 if (Animator!=null) 3355 if (Animator!=null)
3303 Animator.UpdateMovementAnimations(); 3356 {
3357 if (m_updateCount > 0) //KF: DO NOT call UpdateMovementAnimations outside of the m_updateCount wrapper,
3358 { // else its will lock out other animation changes, like ground sit.
3359 Animator.UpdateMovementAnimations();
3360 m_updateCount--;
3361 }
3362 }
3304 3363
3305 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3364 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
3306 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; 3365 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
@@ -3309,7 +3368,7 @@ namespace OpenSim.Region.Framework.Scenes
3309 3368
3310 if (m_lastColCount != coldata.Count) 3369 if (m_lastColCount != coldata.Count)
3311 { 3370 {
3312 m_updateCount = 10; 3371 m_updateCount = UPDATE_COUNT;
3313 m_lastColCount = coldata.Count; 3372 m_lastColCount = coldata.Count;
3314 } 3373 }
3315 3374