diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 120 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 17 |
6 files changed, 121 insertions, 54 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8ef5576..9072035 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -332,7 +332,7 @@ namespace OpenSim.Framework | |||
332 | 332 | ||
333 | public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); | 333 | public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); |
334 | 334 | ||
335 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape); | 335 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 RayEnd, LLQuaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, byte RayEndIsIntersection); |
336 | 336 | ||
337 | public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client); | 337 | public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client); |
338 | 338 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 3654a7d..e6512c2 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -46,6 +46,8 @@ namespace OpenSim.Framework | |||
46 | private static object XferLock = new object(); | 46 | private static object XferLock = new object(); |
47 | private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); | 47 | private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); |
48 | 48 | ||
49 | #region Vector Equasions | ||
50 | |||
49 | public static double GetDistanceTo(LLVector3 a, LLVector3 b) | 51 | public static double GetDistanceTo(LLVector3 a, LLVector3 b) |
50 | { | 52 | { |
51 | float dx = a.X - b.X; | 53 | float dx = a.X - b.X; |
@@ -53,6 +55,16 @@ namespace OpenSim.Framework | |||
53 | float dz = a.Z - b.Z; | 55 | float dz = a.Z - b.Z; |
54 | return Math.Sqrt(dx*dx + dy*dy + dz*dz); | 56 | return Math.Sqrt(dx*dx + dy*dy + dz*dz); |
55 | } | 57 | } |
58 | public static double GetMagnitude(LLVector3 a) { | ||
59 | return Math.Sqrt((a.X * a.X) + (a.Y * a.Y) + (a.Z * a.Z)); | ||
60 | } | ||
61 | public static LLVector3 GetNormal(LLVector3 a) | ||
62 | { | ||
63 | float Mag = (float)GetMagnitude(a); | ||
64 | return new LLVector3(a.X / Mag, a.Y / Mag, a.Z / Mag); | ||
65 | |||
66 | } | ||
67 | # endregion | ||
56 | 68 | ||
57 | public static ulong UIntsToLong(uint X, uint Y) | 69 | public static ulong UIntsToLong(uint X, uint Y) |
58 | { | 70 | { |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index b232ed6..e8ae2a7 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -2534,6 +2534,15 @@ namespace OpenSim.Region.ClientStack | |||
2534 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; | 2534 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; |
2535 | if (OnRezObject != null) | 2535 | if (OnRezObject != null) |
2536 | { | 2536 | { |
2537 | //rezPacket.RezData.BypassRaycast; | ||
2538 | //rezPacket.RezData.RayEnd; | ||
2539 | //rezPacket.RezData.RayEndIsIntersection; | ||
2540 | //rezPacket.RezData.RayStart; | ||
2541 | //rezPacket.RezData.RayTargetID; | ||
2542 | //rezPacket.RezData.RemoveItem; | ||
2543 | //rezPacket.RezData.RezSelected; | ||
2544 | //rezPacket.RezData.FromTaskID; | ||
2545 | //MainLog.Instance.Verbose("REZData", rezPacket.ToString()); | ||
2537 | OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); | 2546 | OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); |
2538 | } | 2547 | } |
2539 | break; | 2548 | break; |
@@ -2713,7 +2722,13 @@ namespace OpenSim.Region.ClientStack | |||
2713 | { | 2722 | { |
2714 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack; | 2723 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack; |
2715 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); | 2724 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); |
2716 | OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape); | 2725 | MainLog.Instance.Verbose("REZData", addPacket.ToString()); |
2726 | //BypassRaycast: 1 | ||
2727 | //RayStart: <69.79469, 158.2652, 98.40343> | ||
2728 | //RayEnd: <61.97724, 141.995, 92.58341> | ||
2729 | //RayTargetID: 00000000-0000-0000-0000-000000000000 | ||
2730 | |||
2731 | OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection); | ||
2717 | } | 2732 | } |
2718 | break; | 2733 | break; |
2719 | case PacketType.ObjectShape: | 2734 | case PacketType.ObjectShape: |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index afceaab..077157f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -925,61 +925,107 @@ namespace OpenSim.Region.Environment.Scenes | |||
925 | return myID; | 925 | return myID; |
926 | } | 926 | } |
927 | 927 | ||
928 | public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) | 928 | public LLVector3 GetNewRezLocation(LLVector3 RayStart, LLVector3 RayEnd, LLUUID RayTargetID, LLQuaternion rot, byte bypassRayCast, byte RayEndIsIntersection) |
929 | { | 929 | { |
930 | // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision | 930 | LLVector3 pos = LLVector3.Zero; |
931 | // in the direction the client supplies (the ground level that we clicked) | 931 | if (RayEndIsIntersection == (byte)1) |
932 | // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go | ||
933 | // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did. | ||
934 | // It's wrong many times though. | ||
935 | |||
936 | if (PermissionsMngr.CanRezObject(ownerID, pos)) | ||
937 | { | 932 | { |
938 | EntityIntersection rayTracing = null; | 933 | pos = RayEnd; |
939 | ScenePresence presence = ((ScenePresence) GetScenePresence(ownerID)); | 934 | return pos; |
940 | if (presence != null) | 935 | } |
936 | if (RayTargetID != LLUUID.Zero) | ||
937 | { | ||
938 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | ||
939 | if (target != null) | ||
941 | { | 940 | { |
942 | Vector3 CameraPosition = presence.CameraPosition; | 941 | pos = target.AbsolutePosition; |
943 | Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z); | ||
944 | 942 | ||
945 | float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd); | 943 | //MainLog.Instance.Verbose("RAYTRACE", pos.ToString()); |
944 | //EntityIntersection rayTracing = null; | ||
945 | //ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID)); | ||
946 | //if (presence != null) | ||
947 | //{ | ||
948 | //Vector3 CameraPosition = presence.CameraPosition; | ||
949 | //Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z); | ||
946 | 950 | ||
947 | Vector3 rayDirection = new Vector3(rayEnd.x/raydistance, rayEnd.y/raydistance, rayEnd.z/raydistance); | 951 | //float rayMag = m_innerScene.Vector3Distance(CameraPosition, rayEnd); |
952 | //LLVector3 rayDirectionLL = Util.GetNormal(pos); | ||
948 | 953 | ||
949 | Ray rezRay = new Ray(CameraPosition, rayDirection); | 954 | //Vector3 rayDirection = new Vector3(rayDirectionLL.X, rayDirectionLL.Y, rayDirectionLL.Z); |
950 | 955 | ||
951 | Vector3 RezDirectionFromCamera = rezRay.Direction; | 956 | //Ray rezRay = new Ray(CameraPosition, rayDirection); |
952 | 957 | ||
953 | rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); | 958 | //Vector3 RezDirectionFromCamera = rezRay.Direction; |
954 | } | ||
955 | 959 | ||
956 | if ((rayTracing != null) && (rayTracing.HitTF)) | 960 | //rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); |
957 | { | 961 | //} |
958 | // We raytraced and found a prim in the way of the ground.. so | 962 | |
959 | // We will rez the object somewhere close to the prim. Better math needed. This is a Stub | 963 | //if ((rayTracing != null) && (rayTracing.HitTF)) |
960 | //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z); | 964 | //{ |
961 | Vector3 Newpos = rayTracing.ipoint; | 965 | // We raytraced and found a prim in the way of the ground.. so |
962 | Vector3 NewScale = | 966 | // We will rez the object somewhere close to the prim. Better math needed. This is a Stub |
963 | new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z); | 967 | //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z); |
968 | //Vector3 Newpos = rayTracing.ipoint; | ||
969 | //Vector3 NewScale = | ||
970 | //new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z); | ||
971 | |||
972 | //Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation; | ||
973 | //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z); | ||
974 | |||
975 | //LLQuaternion primLocalRot = rayTracing.obj.RotationOffset; | ||
976 | //Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z); | ||
964 | 977 | ||
965 | Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation; | 978 | //Quaternion NewRot = LocalRot * ParentRot; |
966 | //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z); | ||
967 | 979 | ||
968 | LLQuaternion primLocalRot = rayTracing.obj.RotationOffset; | 980 | //Vector3 RezPoint = Newpos; |
969 | Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z); | ||
970 | 981 | ||
971 | Quaternion NewRot = LocalRot*ParentRot; | 982 | //MainLog.Instance.Verbose("REZINFO", "Possible Rez Point:" + RezPoint.ToString()); |
983 | //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z); | ||
984 | //} | ||
972 | 985 | ||
973 | Vector3 RezPoint = Newpos; | ||
974 | 986 | ||
975 | MainLog.Instance.Verbose("REZINFO", "Possible Rez Point:" + RezPoint.ToString()); | 987 | |
976 | //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z); | 988 | |
989 | |||
990 | return pos; | ||
977 | } | 991 | } |
978 | else | 992 | else |
979 | { | 993 | { |
994 | // fall back to our stupid functionality | ||
995 | pos = RayEnd; | ||
996 | return pos; | ||
997 | } | ||
998 | } | ||
999 | else | ||
1000 | { | ||
1001 | // fall back to our stupid functionality | ||
1002 | pos = RayEnd; | ||
1003 | return pos; | ||
1004 | } | ||
1005 | |||
1006 | } | ||
1007 | |||
1008 | public virtual void AddNewPrim(LLUUID ownerID, LLVector3 RayEnd, LLQuaternion rot, PrimitiveBaseShape shape, | ||
1009 | byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, | ||
1010 | byte RayEndIsIntersection) | ||
1011 | { | ||
1012 | // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision | ||
1013 | // in the direction the client supplies (the ground level that we clicked) | ||
1014 | // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go | ||
1015 | // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did. | ||
1016 | // It's wrong many times though. | ||
1017 | |||
1018 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); | ||
1019 | |||
1020 | |||
1021 | |||
1022 | |||
1023 | if (PermissionsMngr.CanRezObject(ownerID, pos)) | ||
1024 | { | ||
1025 | |||
980 | // rez ON the ground, not IN the ground | 1026 | // rez ON the ground, not IN the ground |
981 | pos.Z += 0.25F; | 1027 | pos.Z += 0.25F; |
982 | } | 1028 | |
983 | 1029 | ||
984 | SceneObjectGroup sceneOb = | 1030 | SceneObjectGroup sceneOb = |
985 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); | 1031 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); |
@@ -1018,7 +1064,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1018 | treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree; | 1064 | treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree; |
1019 | treeShape.Scale = scale; | 1065 | treeShape.Scale = scale; |
1020 | treeShape.State = (byte) treeType; | 1066 | treeShape.State = (byte) treeType; |
1021 | AddNewPrim(LLUUID.Random(), position, rotation, treeShape); | 1067 | AddNewPrim(LLUUID.Random(), position, rotation, treeShape,(byte)1,LLVector3.Zero,LLUUID.Zero,(byte)1); |
1022 | } | 1068 | } |
1023 | 1069 | ||
1024 | public void RemovePrim(uint localID, LLUUID avatar_deleter) | 1070 | public void RemovePrim(uint localID, LLUUID avatar_deleter) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 90a975c..dad8812 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -694,19 +694,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
694 | 694 | ||
695 | EntityIntersection returnresult = new EntityIntersection(); | 695 | EntityIntersection returnresult = new EntityIntersection(); |
696 | Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 696 | Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
697 | |||
697 | Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z); | 698 | Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z); |
698 | Quaternion qRotation = | 699 | Quaternion qRotation = |
699 | new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); | 700 | new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); |
700 | 701 | ||
701 | 702 | ||
702 | Quaternion worldRotation = (qRotation*parentrot); | 703 | //Quaternion worldRotation = (qRotation*parentrot); |
703 | Matrix3 worldRotM = worldRotation.ToRotationMatrix(); | 704 | //Matrix3 worldRotM = worldRotation.ToRotationMatrix(); |
704 | 705 | ||
705 | 706 | ||
706 | Vector3 rOrigin = iray.Origin; | 707 | Vector3 rOrigin = iray.Origin; |
707 | Vector3 rDirection = iray.Direction; | 708 | Vector3 rDirection = iray.Direction; |
708 | 709 | ||
710 | |||
709 | 711 | ||
712 | //rDirection = rDirection.Normalize(); | ||
710 | // Buidling the first part of the Quadratic equation | 713 | // Buidling the first part of the Quadratic equation |
711 | Vector3 r2ndDirection = rDirection*rDirection; | 714 | Vector3 r2ndDirection = rDirection*rDirection; |
712 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; | 715 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 2193d07..006d829 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -299,10 +299,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
299 | p2.PhysicsActorType == (int) ActorTypes.Prim)) | 299 | p2.PhysicsActorType == (int) ActorTypes.Prim)) |
300 | { | 300 | { |
301 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) | 301 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) |
302 | { if (p1.IsPhysical) | 302 | { |
303 | { | ||
304 | int q = 1; | ||
305 | } | ||
306 | p2.CollidingObj = true; | 303 | p2.CollidingObj = true; |
307 | //contacts[i].depth = 0.003f; | 304 | //contacts[i].depth = 0.003f; |
308 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | 305 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); |
@@ -313,18 +310,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
313 | } | 310 | } |
314 | else | 311 | else |
315 | { | 312 | { |
316 | if (p1.IsPhysical) | 313 | |
317 | { | 314 | //contacts[i].depth = 0.0000000f; |
318 | int q = 1; | ||
319 | } | ||
320 | contacts[i].depth = 0.0000000f; | ||
321 | } | 315 | } |
322 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | 316 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) |
323 | { | 317 | { |
324 | if (p2.IsPhysical) | 318 | |
325 | { | ||
326 | int q = 1; | ||
327 | } | ||
328 | p1.CollidingObj = true; | 319 | p1.CollidingObj = true; |
329 | //contacts[i].depth = 0.003f; | 320 | //contacts[i].depth = 0.003f; |
330 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | 321 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); |