aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-24 23:25:19 +0100
committerJustin Clark-Casey (justincc)2010-08-24 23:25:19 +0100
commitd69e992665495b98fac4ae8c74266294e85804e6 (patch)
treedf7607ffc030aba10a5fba671248541d4bb29005 /OpenSim/Region/Framework/Scenes/SceneGraph.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.zip
opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.gz
opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.bz2
opensim-SC_OLD-d69e992665495b98fac4ae8c74266294e85804e6.tar.xz
Split out actual scene object insertion code from Scene.Inventory.RezObject and move into SceneGraph.AddNewSceneObject()
The new SceneGraph method is more consumable by region modules that want to extract objects from inventory and add them to the scene in separate stages. This change also reduces the number of redundant client updates scheduled when an object is rezzed directly by a script or region module This code does not touch direct rez by a user
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 9f38a99..31faeec 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -292,6 +292,42 @@ namespace OpenSim.Region.Framework.Scenes
292 292
293 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); 293 return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
294 } 294 }
295
296 /// <summary>
297 /// Add a newly created object to the scene.
298 /// </summary>
299 ///
300 /// This method does not send updates to the client - callers need to handle this themselves.
301 /// <param name="sceneObject"></param>
302 /// <param name="attachToBackup"></param>
303 /// <param name="pos">Position of the object</param>
304 /// <param name="rot">Rotation of the object</param>
305 /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
306 /// <returns></returns>
307 public bool AddNewSceneObject(
308 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
309 {
310 AddNewSceneObject(sceneObject, true, false);
311
312 // we set it's position in world.
313 sceneObject.AbsolutePosition = pos;
314
315 if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
316 {
317 sceneObject.ClearPartAttachmentData();
318 }
319
320 sceneObject.UpdateGroupRotationR(rot);
321
322 //group.ApplyPhysics(m_physicalPrim);
323 if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
324 {
325 sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
326 sceneObject.Velocity = vel;
327 }
328
329 return true;
330 }
295 331
296 /// <summary> 332 /// <summary>
297 /// Add an object to the scene. This will both update the scene, and send information about the 333 /// Add an object to the scene. This will both update the scene, and send information about the