From 60c96ab6878ce0d8d5c7325a83a104081c0673b6 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 11 Dec 2007 18:29:19 +0000 Subject: Couple of more small changes --- OpenSim/Region/Environment/Scenes/Scene.cs | 24 ++++++++++++++-------- .../Region/Environment/Scenes/SceneObjectGroup.cs | 5 ++++- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e4526b2..324b7d3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -845,20 +845,27 @@ namespace OpenSim.Region.Environment.Scenes if (PermissionsMngr.CanRezObject(ownerID, pos)) { - Vector3 CameraPosition = ((ScenePresence)GetScenePresence(ownerID)).CameraPosition; - Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z); - float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd); + EntityIntersection rayTracing = null; + ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID)); + if (presence != null) + { + Vector3 CameraPosition = presence.CameraPosition; + Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z); - Vector3 rayDirection = new Vector3(rayEnd.x / raydistance, rayEnd.y / raydistance, rayEnd.z / raydistance); + float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd); - Ray rezRay = new Ray(CameraPosition, rayDirection); + Vector3 rayDirection = new Vector3(rayEnd.x / raydistance, rayEnd.y / raydistance, rayEnd.z / raydistance); - Vector3 RezDirectionFromCamera = rezRay.Direction; + Ray rezRay = new Ray(CameraPosition, rayDirection); - EntityIntersection rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); + Vector3 RezDirectionFromCamera = rezRay.Direction; - if (rayTracing.HitTF) + rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); + + } + + if ((rayTracing != null) && ( rayTracing.HitTF)) { // We raytraced and found a prim in the way of the ground.. so // We will rez the object somewhere close to the prim. Better math needed. This is a Stub @@ -918,6 +925,7 @@ namespace OpenSim.Region.Environment.Scenes { PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); treeShape.PathCurve = 16; + treeShape.PathEnd = 49900; treeShape.PCode = newTree ? (byte)libsecondlife.ObjectManager.PCode.NewTree : (byte)libsecondlife.ObjectManager.PCode.Tree; treeShape.Scale = scale; treeShape.State = (byte)treeType; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 89e2f0d..a039015 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1316,8 +1316,11 @@ namespace OpenSim.Region.Environment.Scenes if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) { AbsolutePosition = pos; - ScheduleGroupForTerseUpdate(); + } + //we need to do a terse update even if the move wasn't allowed + // so that the position is reset in the client (the object snaps back) + ScheduleGroupForTerseUpdate(); } /// -- cgit v1.1