diff options
author | Teravus Ovares | 2008-05-01 15:17:49 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-01 15:17:49 +0000 |
commit | 56b4f5a2ea582d347c69ce30405e078270090dfa (patch) | |
tree | 088745a3b4457b58c95c1eec1de5d5299d3493e9 /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * Assorted spring cleanings. (diff) | |
download | opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.zip opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.gz opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.bz2 opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.xz |
* committing what I've got so far for DuplicateOnRay so I don't fight the conflict monster later. Not done yet, doesn't crash the server.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 96 |
1 files changed, 91 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 30e3815..60d6293 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1169,7 +1169,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1169 | return myID; | 1169 | return myID; |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | public LLVector3 GetNewRezLocation(LLVector3 RayStart, LLVector3 RayEnd, LLUUID RayTargetID, LLQuaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, LLVector3 scale) | 1172 | public LLVector3 GetNewRezLocation(LLVector3 RayStart, LLVector3 RayEnd, LLUUID RayTargetID, LLQuaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, LLVector3 scale, bool FaceCenter) |
1173 | { | 1173 | { |
1174 | LLVector3 pos = LLVector3.Zero; | 1174 | LLVector3 pos = LLVector3.Zero; |
1175 | if (RayEndIsIntersection == (byte)1) | 1175 | if (RayEndIsIntersection == (byte)1) |
@@ -1196,7 +1196,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1196 | Ray NewRay = new Ray(AXOrigin, AXdirection); | 1196 | Ray NewRay = new Ray(AXOrigin, AXdirection); |
1197 | 1197 | ||
1198 | // Ray Trace against target here | 1198 | // Ray Trace against target here |
1199 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1,0,0,0), frontFacesOnly); | 1199 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1,0,0,0), frontFacesOnly, FaceCenter); |
1200 | 1200 | ||
1201 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1201 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1202 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1202 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
@@ -1228,7 +1228,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1228 | { | 1228 | { |
1229 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1229 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1230 | 1230 | ||
1231 | EntityIntersection ei = m_innerScene.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true); | 1231 | EntityIntersection ei = m_innerScene.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1232 | 1232 | ||
1233 | // Un-comment the following line to print the raytrace results to the console. | 1233 | // Un-comment the following line to print the raytrace results to the console. |
1234 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1234 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
@@ -1254,7 +1254,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1254 | byte RayEndIsIntersection) | 1254 | byte RayEndIsIntersection) |
1255 | { | 1255 | { |
1256 | 1256 | ||
1257 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f)); | 1257 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false); |
1258 | 1258 | ||
1259 | if (PermissionsMngr.CanRezObject(ownerID, pos)) | 1259 | if (PermissionsMngr.CanRezObject(ownerID, pos)) |
1260 | { | 1260 | { |
@@ -1560,6 +1560,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1560 | client.OnLinkObjects += m_innerScene.LinkObjects; | 1560 | client.OnLinkObjects += m_innerScene.LinkObjects; |
1561 | client.OnDelinkObjects += m_innerScene.DelinkObjects; | 1561 | client.OnDelinkObjects += m_innerScene.DelinkObjects; |
1562 | client.OnObjectDuplicate += m_innerScene.DuplicateObject; | 1562 | client.OnObjectDuplicate += m_innerScene.DuplicateObject; |
1563 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | ||
1563 | client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; | 1564 | client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; |
1564 | client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; | 1565 | client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; |
1565 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest); | 1566 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest); |
@@ -1632,7 +1633,92 @@ namespace OpenSim.Region.Environment.Scenes | |||
1632 | 1633 | ||
1633 | 1634 | ||
1634 | } | 1635 | } |
1635 | 1636 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID, | |
1637 | LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart, | ||
1638 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) | ||
1639 | { | ||
1640 | |||
1641 | LLVector3 pos = LLVector3.Zero; | ||
1642 | bool frontFacesOnly = true; | ||
1643 | |||
1644 | SceneObjectPart target = GetSceneObjectPart(localID); | ||
1645 | |||
1646 | if (target != null) | ||
1647 | { | ||
1648 | |||
1649 | LLVector3 direction = LLVector3.Norm(RayEnd - RayStart); | ||
1650 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | ||
1651 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | ||
1652 | |||
1653 | |||
1654 | if (target != null) | ||
1655 | { | ||
1656 | if (target.ParentGroup != null) | ||
1657 | { | ||
1658 | pos = target.AbsolutePosition; | ||
1659 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); | ||
1660 | |||
1661 | // TODO: Raytrace better here | ||
1662 | |||
1663 | //EntityIntersection ei = m_innerScene.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); | ||
1664 | Ray NewRay = new Ray(AXOrigin, AXdirection); | ||
1665 | |||
1666 | // Ray Trace against target here | ||
1667 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, false); | ||
1668 | |||
1669 | // Un-comment out the following line to Get Raytrace results printed to the console. | ||
1670 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | ||
1671 | float ScaleOffset = 0.5f; | ||
1672 | |||
1673 | // If we hit something | ||
1674 | if (ei.HitTF) | ||
1675 | { | ||
1676 | LLVector3 scale = target.Scale; | ||
1677 | LLVector3 scaleComponent = new LLVector3(ei.AAfaceNormal.x, ei.AAfaceNormal.y, ei.AAfaceNormal.z); | ||
1678 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | ||
1679 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | ||
1680 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | ||
1681 | ScaleOffset = Math.Abs(ScaleOffset); | ||
1682 | LLVector3 intersectionpoint = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z); | ||
1683 | |||
1684 | |||
1685 | |||
1686 | if (CopyCenters) | ||
1687 | { | ||
1688 | // now we cast a ray from inside the prim(absolute position) to one of it's faces along the face normal. | ||
1689 | LLVector3 direction2 = LLVector3.Norm(pos - target.AbsolutePosition); | ||
1690 | Vector3 AXOrigin2 = new Vector3(target.AbsolutePosition.X, target.AbsolutePosition.Y, target.AbsolutePosition.Z); | ||
1691 | Vector3 AXdirection2 = ei.AAfaceNormal; | ||
1692 | Ray NewRay2 = new Ray(AXOrigin2, AXdirection2); | ||
1693 | EntityIntersection ei2 = target.TestIntersectionOBB(NewRay2, new Quaternion(1, 0, 0, 0), false, CopyCenters); | ||
1694 | if (ei2.HitTF) | ||
1695 | { | ||
1696 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei2.HitTF.ToString() + " Point: " + ei2.ipoint.ToString() + " Normal: " + ei2.normal.ToString()); | ||
1697 | pos = new LLVector3(ei2.ipoint.x,ei2.ipoint.y,ei2.ipoint.z); | ||
1698 | } | ||
1699 | } | ||
1700 | LLVector3 normal = new LLVector3(ei.normal.x, ei.normal.y, ei.normal.z); | ||
1701 | // Set the position to the intersection point | ||
1702 | LLVector3 offset = (normal * (ScaleOffset / 2f)); | ||
1703 | pos = (intersectionpoint + offset); | ||
1704 | |||
1705 | // stick in offset format from the original prim | ||
1706 | pos = pos - target.ParentGroup.AbsolutePosition; | ||
1707 | m_innerScene.DuplicateObject(target.ParentGroup.LocalId, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | ||
1708 | } | ||
1709 | |||
1710 | |||
1711 | return; | ||
1712 | } | ||
1713 | return; | ||
1714 | } | ||
1715 | |||
1716 | } | ||
1717 | |||
1718 | |||
1719 | |||
1720 | |||
1721 | } | ||
1636 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) | 1722 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) |
1637 | { | 1723 | { |
1638 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); | 1724 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); |