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.afrisby
parent
8c9f006dd3
commit
0d5311e49b
|
@ -8,6 +8,7 @@ using OpenSim.Framework.Types;
|
||||||
using OpenSim.Framework.Communications.Caches;
|
using OpenSim.Framework.Communications.Caches;
|
||||||
using OpenSim.Framework.Data;
|
using OpenSim.Framework.Data;
|
||||||
using OpenSim.Framework.Utilities;
|
using OpenSim.Framework.Utilities;
|
||||||
|
using OpenSim.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
@ -354,6 +355,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
remoteClient.SendInventoryItemUpdate(item);
|
remoteClient.SendInventoryItemUpdate(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID);
|
||||||
|
if (rootPart.PhysActor != null)
|
||||||
|
{
|
||||||
|
this.phyScene.RemovePrim(rootPart.PhysActor);
|
||||||
|
}
|
||||||
|
|
||||||
storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
|
storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
|
||||||
((SceneObjectGroup)selectedEnt).DeleteGroup();
|
((SceneObjectGroup)selectedEnt).DeleteGroup();
|
||||||
|
|
||||||
|
@ -361,6 +368,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
Entities.Remove(((SceneObjectGroup)selectedEnt).UUID);
|
Entities.Remove(((SceneObjectGroup)selectedEnt).UUID);
|
||||||
}
|
}
|
||||||
|
((SceneObjectGroup)selectedEnt).DeleteParts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,6 +413,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
|
SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
|
||||||
this.AddEntity(group);
|
this.AddEntity(group);
|
||||||
group.AbsolutePosition = pos;
|
group.AbsolutePosition = pos;
|
||||||
|
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
||||||
|
rootPart.PhysActor = phyScene.AddPrim(
|
||||||
|
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
|
||||||
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
|
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -504,11 +504,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
AddEntityFromStorage(prim);
|
AddEntityFromStorage(prim);
|
||||||
SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
|
SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
|
||||||
// rootPart.PhysActor = phyScene.AddPrim(
|
rootPart.PhysActor = phyScene.AddPrim(
|
||||||
// new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
|
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
|
||||||
// new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
// new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
// rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
|
||||||
}
|
}
|
||||||
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
|
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
|
||||||
}
|
}
|
||||||
|
@ -547,8 +547,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
|
SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
|
||||||
AddEntity(sceneOb);
|
AddEntity(sceneOb);
|
||||||
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
|
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
|
||||||
//rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
|
rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
|
||||||
// new Axiom.Math.Quaternion());
|
new Axiom.Math.Quaternion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemovePrim(uint localID, LLUUID avatar_deleter)
|
public void RemovePrim(uint localID, LLUUID avatar_deleter)
|
||||||
|
@ -626,11 +626,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
AddEntity(obj);
|
AddEntity(obj);
|
||||||
|
|
||||||
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
|
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
|
||||||
//rootPart.PhysActor = phyScene.AddPrim(
|
rootPart.PhysActor = phyScene.AddPrim(
|
||||||
// new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
|
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
|
||||||
// new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
|
||||||
// new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
|
||||||
// rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
|
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
|
||||||
primCount++;
|
primCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private string m_inventoryFileName = "";
|
private string m_inventoryFileName = "";
|
||||||
private LLUUID m_folderID = LLUUID.Zero;
|
private LLUUID m_folderID = LLUUID.Zero;
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
public PhysicsActor PhysActor = null;
|
public PhysicsActor PhysActor = null;
|
||||||
|
|
||||||
protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
|
protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
|
||||||
|
|
|
@ -80,6 +80,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RemovePrim(PhysicsActor prim)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void RemoveAvatar(PhysicsActor actor)
|
public override void RemoveAvatar(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
BasicActor act = (BasicActor)actor;
|
BasicActor act = (BasicActor)actor;
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Physics.Manager
|
||||||
|
|
||||||
public abstract void RemoveAvatar(PhysicsActor actor);
|
public abstract void RemoveAvatar(PhysicsActor actor);
|
||||||
|
|
||||||
|
public abstract void RemovePrim(PhysicsActor prim);
|
||||||
|
|
||||||
public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation);
|
public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation);
|
||||||
|
|
||||||
public abstract void Simulate(float timeStep);
|
public abstract void Simulate(float timeStep);
|
||||||
|
@ -74,6 +76,11 @@ namespace OpenSim.Physics.Manager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RemovePrim(PhysicsActor prim)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||||
|
|
|
@ -146,6 +146,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RemovePrim(PhysicsActor prim)
|
||||||
|
{
|
||||||
|
if (prim is OdePrim)
|
||||||
|
{
|
||||||
|
d.GeomDestroy(((OdePrim)prim).prim_geom);
|
||||||
|
this._prims.Remove((OdePrim)prim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation);
|
//Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation);
|
||||||
|
@ -397,7 +406,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private PhysicsVector _size;
|
private PhysicsVector _size;
|
||||||
private PhysicsVector _acceleration;
|
private PhysicsVector _acceleration;
|
||||||
private Quaternion _orientation;
|
private Quaternion _orientation;
|
||||||
IntPtr prim_geom;
|
public IntPtr prim_geom;
|
||||||
|
|
||||||
public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation)
|
public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,6 +98,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RemovePrim(PhysicsActor prim)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void RemoveAvatar(PhysicsActor actor)
|
public override void RemoveAvatar(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue