Add localID to physical object creation functions.

bulletsim
Mic Bowman 2011-06-15 11:31:32 -07:00
parent 29da57e380
commit ad84728aba
5 changed files with 25 additions and 5 deletions

View File

@ -1467,6 +1467,7 @@ namespace OpenSim.Region.Framework.Scenes
newPart.PhysActor newPart.PhysActor
= m_scene.PhysicsScene.AddPrimShape( = m_scene.PhysicsScene.AddPrimShape(
part.LocalId,
string.Format("{0}/{1}", part.Name, part.UUID), string.Format("{0}/{1}", part.Name, part.UUID),
pbs, pbs,
part.AbsolutePosition, part.AbsolutePosition,
@ -1474,7 +1475,6 @@ namespace OpenSim.Region.Framework.Scenes
part.RotationOffset, part.RotationOffset,
part.PhysActor.IsPhysical); part.PhysActor.IsPhysical);
newPart.PhysActor.LocalID = part.LocalId;
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
} }

View File

@ -1582,6 +1582,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
{ {
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
LocalId,
string.Format("{0}/{1}", Name, UUID), string.Format("{0}/{1}", Name, UUID),
Shape, Shape,
AbsolutePosition, AbsolutePosition,
@ -1594,7 +1595,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
PhysActor.SOPDescription = this.Description; PhysActor.SOPDescription = this.Description;
PhysActor.LocalID = LocalId;
DoPhysicsPropertyUpdate(RigidBody, true); DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
} }
@ -4410,6 +4410,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// It's not phantom anymore. So make sure the physics engine get's knowledge of it // It's not phantom anymore. So make sure the physics engine get's knowledge of it
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
LocalId,
string.Format("{0}/{1}", Name, UUID), string.Format("{0}/{1}", Name, UUID),
Shape, Shape,
AbsolutePosition, AbsolutePosition,
@ -4420,7 +4421,6 @@ namespace OpenSim.Region.Framework.Scenes
pa = PhysActor; pa = PhysActor;
if (pa != null) if (pa != null)
{ {
pa.LocalID = LocalId;
DoPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {

View File

@ -3295,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pVec = AbsolutePosition; Vector3 pVec = AbsolutePosition;
// Old bug where the height was in centimeters instead of meters // Old bug where the height was in centimeters instead of meters
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, m_physicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec,
new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying);
scene.AddPhysicsActorTaint(m_physicsActor); scene.AddPhysicsActorTaint(m_physicsActor);

View File

@ -142,7 +142,12 @@ namespace OpenSim.Region.Physics.Manager
public abstract PrimitiveBaseShape Shape { set; } public abstract PrimitiveBaseShape Shape { set; }
public abstract uint LocalID { set; } uint m_baseLocalID;
public virtual uint LocalID
{
set { m_baseLocalID = value; }
get { return m_baseLocalID; }
}
public abstract bool Grabbed { set; } public abstract bool Grabbed { set; }

View File

@ -66,6 +66,13 @@ namespace OpenSim.Region.Physics.Manager
public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying);
public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying)
{
PhysicsActor ret = AddAvatar(avName, position, size, isFlying);
if (ret != null) ret.LocalID = localID;
return ret;
}
public abstract void RemoveAvatar(PhysicsActor actor); public abstract void RemoveAvatar(PhysicsActor actor);
public abstract void RemovePrim(PhysicsActor prim); public abstract void RemovePrim(PhysicsActor prim);
@ -75,6 +82,14 @@ namespace OpenSim.Region.Physics.Manager
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical); Vector3 size, Quaternion rotation, bool isPhysical);
public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{
PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical);
if (ret != null) ret.LocalID = localID;
return ret;
}
public virtual float TimeDilation public virtual float TimeDilation
{ {
get { return 1.0f; } get { return 1.0f; }