diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 046332b9a2..3ce795597e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7948a6fa52..94a4e310ec 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -31,6 +31,7 @@ using System.Drawing; using System.Drawing.Imaging; using System.Threading; using System.Timers; +using Axiom.Math; using libsecondlife; using libsecondlife.Packets; using OpenJPEGNet; @@ -1079,7 +1080,37 @@ namespace OpenSim.Region.Environment.Scenes if (target != null) { pos = target.AbsolutePosition; - // TODO: Raytrace here + //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()); + //target.Scale.X + if (Math.Abs(target.Scale.X - target.Scale.Y) > 4.5f + || Math.Abs(target.Scale.Y - target.Scale.Z) > 4.5f + || Math.Abs(target.Scale.Z - target.Scale.X) > 4.5f) + { + + // for now lets use the old method here as the new method works by using the largest scale vector + // component as the radius of a sphere and produces wide results if there's a huge difference + // between the x/y/z vector components + + // If one scale component is less then .21m, it's likely being used as a thin block and therefore + // the raytracing would produce a wide result. + + + } + else + { + // TODO: Raytrace better here + LLVector3 direction = LLVector3.Norm(RayEnd - RayStart); + Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); + Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); + EntityIntersection ei = m_innerScene.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); + //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); + + if (ei.HitTF) + { + pos = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z); + } + + } return pos; } else diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 67048bf8d5..7fd19638be 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -875,6 +875,13 @@ namespace OpenSim.Region.Environment.Scenes if (vScale.z > radius) radius = vScale.z; + // the second part of this is the default prim size + // once we factor in the aabb of the prim we're adding we can + // change this to; + // radius = (radius / 2) - 0.01f; + // + radius = (radius / 2) + (0.5f / 2) - 0.1f; + //radius = radius; float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z -