From 90567a9eaac717ab86316c078e148f8fe13432ac Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 21 May 2011 00:02:53 +0100 Subject: refactor Scene.RezObject() to use AddNewSceneObject() rather than copy/pasting code with small differences --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0cff011..cdb4e41 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -311,25 +311,26 @@ namespace OpenSim.Region.Framework.Scenes /// This method does not send updates to the client - callers need to handle this themselves. /// /// - /// Position of the object - /// Rotation of the object + /// Position of the object. If null then the position stored in the object is used. + /// Rotation of the object. If null then the rotation stored in the object is used. /// Velocity of the object. This parameter only has an effect if the object is physical /// public bool AddNewSceneObject( - SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) + SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { AddNewSceneObject(sceneObject, true, false); - // we set it's position in world. - sceneObject.AbsolutePosition = pos; + if (pos != null) + sceneObject.AbsolutePosition = (Vector3)pos; if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) { sceneObject.ClearPartAttachmentData(); } - - sceneObject.UpdateGroupRotationR(rot); - + + if (rot != null) + sceneObject.UpdateGroupRotationR((Quaternion)rot); + //group.ApplyPhysics(m_physicalPrim); if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) { -- cgit v1.1