aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-08-23 17:21:08 +0000
committerMW2007-08-23 17:21:08 +0000
commit0d5311e49bf5700efcf779bfa4bc83a00585c424 (patch)
tree168ea226f01a7e486f4dd6f288ef00afdd67ff68
parentgrouping of functions to make the overall logic easier to grasp for people, (diff)
downloadopensim-SC_OLD-0d5311e49bf5700efcf779bfa4bc83a00585c424.zip
opensim-SC_OLD-0d5311e49bf5700efcf779bfa4bc83a00585c424.tar.gz
opensim-SC_OLD-0d5311e49bf5700efcf779bfa4bc83a00585c424.tar.bz2
opensim-SC_OLD-0d5311e49bf5700efcf779bfa4bc83a00585c424.tar.xz
Added RemovePrim method to the physics plugins interface.
Implemented that method in ODE plugin. Hooked it up so when deleting/taking prims into your inventory they will be removed from physics engine. Enabled the other physics hook ups in Scene.cs (and also added registering prims with physics plugin when they are rezzed from Inventory.) So now to get the avatar to prim collision testing working, just change to use the ODE plugin (in the OpenSim.ini file, physics = OpenDynamicsEngine). Remember though ODE only really works (without problems) when running with a single region.
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs1
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs7
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs11
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs5
7 files changed, 54 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 9cbd65b..83cd83c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -8,6 +8,7 @@ using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Communications.Caches;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11using OpenSim.Physics.Manager;
11 12
12namespace OpenSim.Region.Environment.Scenes 13namespace OpenSim.Region.Environment.Scenes
13{ 14{
@@ -354,6 +355,12 @@ namespace OpenSim.Region.Environment.Scenes
354 remoteClient.SendInventoryItemUpdate(item); 355 remoteClient.SendInventoryItemUpdate(item);
355 } 356 }
356 357
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID);
359 if (rootPart.PhysActor != null)
360 {
361 this.phyScene.RemovePrim(rootPart.PhysActor);
362 }
363
357 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 364 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
358 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 365 ((SceneObjectGroup)selectedEnt).DeleteGroup();
359 366
@@ -361,6 +368,7 @@ namespace OpenSim.Region.Environment.Scenes
361 { 368 {
362 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 369 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID);
363 } 370 }
371 ((SceneObjectGroup)selectedEnt).DeleteParts();
364 } 372 }
365 } 373 }
366 } 374 }
@@ -405,6 +413,12 @@ namespace OpenSim.Region.Environment.Scenes
405 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 413 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
406 this.AddEntity(group); 414 this.AddEntity(group);
407 group.AbsolutePosition = pos; 415 group.AbsolutePosition = pos;
416 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
417 rootPart.PhysActor = phyScene.AddPrim(
418 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
419 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
420 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
421 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
408 } 422 }
409 423
410 424
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 87a42b1..282e548 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -504,11 +504,11 @@ namespace OpenSim.Region.Environment.Scenes
504 { 504 {
505 AddEntityFromStorage(prim); 505 AddEntityFromStorage(prim);
506 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 506 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
507 // rootPart.PhysActor = phyScene.AddPrim( 507 rootPart.PhysActor = phyScene.AddPrim(
508 // new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 508 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
509 // new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 509 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
510 // new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 510 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
511 // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 511 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
512 } 512 }
513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
514 } 514 }
@@ -547,8 +547,8 @@ namespace OpenSim.Region.Environment.Scenes
547 SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); 547 SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
548 AddEntity(sceneOb); 548 AddEntity(sceneOb);
549 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 549 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
550 //rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 550 rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
551 // new Axiom.Math.Quaternion()); 551 new Axiom.Math.Quaternion());
552 } 552 }
553 553
554 public void RemovePrim(uint localID, LLUUID avatar_deleter) 554 public void RemovePrim(uint localID, LLUUID avatar_deleter)
@@ -626,11 +626,11 @@ namespace OpenSim.Region.Environment.Scenes
626 AddEntity(obj); 626 AddEntity(obj);
627 627
628 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 628 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
629 //rootPart.PhysActor = phyScene.AddPrim( 629 rootPart.PhysActor = phyScene.AddPrim(
630 // new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 630 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
631 // new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 631 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
632 // new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 632 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
633 // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 633 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
634 primCount++; 634 primCount++;
635 } 635 }
636 } 636 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index eea2d72..d7479bd 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -23,6 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
23 private string m_inventoryFileName = ""; 23 private string m_inventoryFileName = "";
24 private LLUUID m_folderID = LLUUID.Zero; 24 private LLUUID m_folderID = LLUUID.Zero;
25 25
26 [XmlIgnore]
26 public PhysicsActor PhysActor = null; 27 public PhysicsActor PhysActor = null;
27 28
28 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 29 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 92b6929..c1ad555 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -80,6 +80,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
80 return act; 80 return act;
81 } 81 }
82 82
83 public override void RemovePrim(PhysicsActor prim)
84 {
85
86 }
87
83 public override void RemoveAvatar(PhysicsActor actor) 88 public override void RemoveAvatar(PhysicsActor actor)
84 { 89 {
85 BasicActor act = (BasicActor)actor; 90 BasicActor act = (BasicActor)actor;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 0e75b04..11789a2 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Physics.Manager
44 44
45 public abstract void RemoveAvatar(PhysicsActor actor); 45 public abstract void RemoveAvatar(PhysicsActor actor);
46 46
47 public abstract void RemovePrim(PhysicsActor prim);
48
47 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation); 49 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation);
48 50
49 public abstract void Simulate(float timeStep); 51 public abstract void Simulate(float timeStep);
@@ -74,6 +76,11 @@ namespace OpenSim.Physics.Manager
74 76
75 } 77 }
76 78
79 public override void RemovePrim(PhysicsActor prim)
80 {
81
82 }
83
77 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 84 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
78 { 85 {
79 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); 86 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index f168340..420693b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -143,7 +143,16 @@ namespace OpenSim.Region.Physics.OdePlugin
143 143
144 public override void RemoveAvatar(PhysicsActor actor) 144 public override void RemoveAvatar(PhysicsActor actor)
145 { 145 {
146
147 }
146 148
149 public override void RemovePrim(PhysicsActor prim)
150 {
151 if (prim is OdePrim)
152 {
153 d.GeomDestroy(((OdePrim)prim).prim_geom);
154 this._prims.Remove((OdePrim)prim);
155 }
147 } 156 }
148 157
149 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 158 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
@@ -397,7 +406,7 @@ namespace OpenSim.Region.Physics.OdePlugin
397 private PhysicsVector _size; 406 private PhysicsVector _size;
398 private PhysicsVector _acceleration; 407 private PhysicsVector _acceleration;
399 private Quaternion _orientation; 408 private Quaternion _orientation;
400 IntPtr prim_geom; 409 public IntPtr prim_geom;
401 410
402 public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation) 411 public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation)
403 { 412 {
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index f86eedf..ab7d5bc 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -98,6 +98,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
98 return act; 98 return act;
99 } 99 }
100 100
101 public override void RemovePrim(PhysicsActor prim)
102 {
103
104 }
105
101 public override void RemoveAvatar(PhysicsActor actor) 106 public override void RemoveAvatar(PhysicsActor actor)
102 { 107 {
103 108