diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e87500ac85..18376c317e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2110,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart target = GetSceneObjectPart(RayTargetID); Vector3 direction = Vector3.Normalize(RayEnd - RayStart); - Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); - Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); + Vector3 AXOrigin = RayStart; + Vector3 AXdirection = direction; if (target != null) { @@ -2127,19 +2127,19 @@ namespace OpenSim.Region.Framework.Scenes EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); // Un-comment out the following line to Get Raytrace results printed to the console. - // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); + // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); float ScaleOffset = 0.5f; // If we hit something if (ei.HitTF) { - Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); + Vector3 scaleComponent = ei.AAfaceNormal; if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Z != 0) ScaleOffset = scale.Z; ScaleOffset = Math.Abs(ScaleOffset); - Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); - Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); + Vector3 intersectionpoint = ei.ipoint; + Vector3 normal = ei.normal; // Set the position to the intersection point Vector3 offset = (normal * (ScaleOffset / 2f)); pos = (intersectionpoint + offset); @@ -2164,8 +2164,9 @@ namespace OpenSim.Region.Framework.Scenes if (ei.HitTF) { - pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); - } else + pos = ei.ipoint; + } + else { // fall back to our stupid functionality pos = RayEnd; @@ -3218,8 +3219,8 @@ namespace OpenSim.Region.Framework.Scenes if (target != null && target2 != null) { Vector3 direction = Vector3.Normalize(RayEnd - RayStart); - Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); - Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); + Vector3 AXOrigin = RayStart; + Vector3 AXdirection = direction; pos = target2.AbsolutePosition; //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()); @@ -3240,13 +3241,13 @@ namespace OpenSim.Region.Framework.Scenes if (ei.HitTF) { Vector3 scale = target.Scale; - Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); + Vector3 scaleComponent = ei.AAfaceNormal; if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Z != 0) ScaleOffset = scale.Z; ScaleOffset = Math.Abs(ScaleOffset); - Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); - Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); + Vector3 intersectionpoint = ei.ipoint; + Vector3 normal = ei.normal; Vector3 offset = normal * (ScaleOffset / 2f); pos = intersectionpoint + offset; @@ -3266,6 +3267,7 @@ namespace OpenSim.Region.Framework.Scenes { copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); } + if (copy != null) EventManager.TriggerObjectAddedToScene(copy); } @@ -5098,7 +5100,7 @@ namespace OpenSim.Region.Framework.Scenes case PhysicsJointType.Ball: { Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); - Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); + Vector3 proxyPos = jointAnchor; jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update } break; @@ -5123,7 +5125,7 @@ namespace OpenSim.Region.Framework.Scenes jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); } - Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); + Vector3 proxyPos = jointAnchor; Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update @@ -5224,8 +5226,8 @@ namespace OpenSim.Region.Framework.Scenes y = Heightmap.Height - 1; Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); - Vector3 p1 = new Vector3(p0); - Vector3 p2 = new Vector3(p0); + Vector3 p1 = p0; + Vector3 p2 = p0; p1.X += 1.0f; if (p1.X < Heightmap.Width)