From 14a191b285c7bf14a1aa46457fb5c9c3425510c1 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 30 Dec 2007 16:00:55 +0000 Subject: * re-applied AddNewPrim refactoring... third time now... --- OpenSim/Region/Environment/Scenes/Scene.cs | 70 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d710e49..a0f19bd 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1008,13 +1008,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual void AddNewPrim(LLUUID ownerID, LLVector3 RayEnd, LLQuaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, byte RayEndIsIntersection) - { - // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision - // in the direction the client supplies (the ground level that we clicked) - // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go - // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did. - // It's wrong many times though. - + { LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); @@ -1022,36 +1016,40 @@ namespace OpenSim.Region.Environment.Scenes if (PermissionsMngr.CanRezObject(ownerID, pos)) { - - // rez ON the ground, not IN the ground + // rez ON the ground, not IN the ground pos.Z += 0.25F; - - - SceneObjectGroup sceneOb = - new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); - AddEntity(sceneOb); - SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); - // if grass or tree, make phantom - //rootPart.ApplySanePermissions(); - if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) - { - rootPart.AddFlag(LLObject.ObjectFlags.Phantom); - //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; - } - // if not phantom, add to physics - bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); - if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) - { - rootPart.PhysActor = - PhysicsScene.AddPrimShape( - rootPart.Name, - rootPart.Shape, - new PhysicsVector(pos.X, pos.Y, pos.Z), - new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), - new Quaternion(), UsePhysics); - // subscribe to physics events. - rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); - } + + + AddNewPrim(ownerID, pos, rot, shape); + } + } + + public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) + { + SceneObjectGroup sceneOb = + new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); + AddEntity(sceneOb); + SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); + // if grass or tree, make phantom + //rootPart.ApplySanePermissions(); + if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) + { + rootPart.AddFlag(LLObject.ObjectFlags.Phantom); + //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; + } + // if not phantom, add to physics + bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); + if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) + { + rootPart.PhysActor = + PhysicsScene.AddPrimShape( + rootPart.Name, + rootPart.Shape, + new PhysicsVector(pos.X, pos.Y, pos.Z), + new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), + new Quaternion(), UsePhysics); + // subscribe to physics events. + rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); } } -- cgit v1.1