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.Data;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Physics.Manager;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
|
@ -354,6 +355,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
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);
|
||||
((SceneObjectGroup)selectedEnt).DeleteGroup();
|
||||
|
||||
|
@ -361,6 +368,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
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);
|
||||
this.AddEntity(group);
|
||||
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);
|
||||
SceneObjectPart rootPart = prim.GetChildPart(prim.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));
|
||||
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));
|
||||
}
|
||||
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);
|
||||
AddEntity(sceneOb);
|
||||
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),
|
||||
// new Axiom.Math.Quaternion());
|
||||
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());
|
||||
}
|
||||
|
||||
public void RemovePrim(uint localID, LLUUID avatar_deleter)
|
||||
|
@ -626,11 +626,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
AddEntity(obj);
|
||||
|
||||
SceneObjectPart rootPart = obj.GetChildPart(obj.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));
|
||||
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));
|
||||
primCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private string m_inventoryFileName = "";
|
||||
private LLUUID m_folderID = LLUUID.Zero;
|
||||
|
||||
[XmlIgnore]
|
||||
public PhysicsActor PhysActor = null;
|
||||
|
||||
protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
|
||||
|
|
|
@ -80,6 +80,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
return act;
|
||||
}
|
||||
|
||||
public override void RemovePrim(PhysicsActor prim)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
BasicActor act = (BasicActor)actor;
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Physics.Manager
|
|||
|
||||
public abstract void RemoveAvatar(PhysicsActor actor);
|
||||
|
||||
public abstract void RemovePrim(PhysicsActor prim);
|
||||
|
||||
public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation);
|
||||
|
||||
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)
|
||||
{
|
||||
MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||
|
|
|
@ -143,7 +143,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -397,7 +406,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private PhysicsVector _size;
|
||||
private PhysicsVector _acceleration;
|
||||
private Quaternion _orientation;
|
||||
IntPtr prim_geom;
|
||||
public IntPtr prim_geom;
|
||||
|
||||
public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
return act;
|
||||
}
|
||||
|
||||
public override void RemovePrim(PhysicsActor prim)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue