initial introdution of physics actor building control.
parent
6cc9aa30ac
commit
6af01f6767
|
@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
so.AttachedAvatar = UUID.Zero;
|
||||
rootPart.SetParentLocalId(0);
|
||||
so.ClearPartAttachmentData();
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive,false);
|
||||
so.HasGroupChanged = true;
|
||||
rootPart.Rezzed = DateTime.Now;
|
||||
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
|
|
|
@ -4766,7 +4766,7 @@ Environment.Exit(1);
|
|||
bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0);
|
||||
if (wasUsingPhysics)
|
||||
{
|
||||
jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock
|
||||
jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1281,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_rootPart.SetParentLocalId(0);
|
||||
AttachmentPoint = (byte)0;
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
|
||||
// must check if buildind should be true or false here
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
|
||||
HasGroupChanged = true;
|
||||
RootPart.Rezzed = DateTime.Now;
|
||||
RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
|
@ -1581,21 +1582,33 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void ApplyPhysics()
|
||||
{
|
||||
// Apply physics to the root prim
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
|
||||
// m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
|
||||
|
||||
// Apply physics to child prims
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
ResetChildPrimPhysicsPositions();
|
||||
|
||||
// Apply physics to the root prim
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true);
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
SceneObjectPart part = parts[i];
|
||||
if (part.LocalId != m_rootPart.LocalId)
|
||||
part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive);
|
||||
}
|
||||
// part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive);
|
||||
part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true);
|
||||
|
||||
}
|
||||
// Hack to get the physics scene geometries in the right spot
|
||||
ResetChildPrimPhysicsPositions();
|
||||
// ResetChildPrimPhysicsPositions();
|
||||
if (m_rootPart.PhysActor != null)
|
||||
m_rootPart.PhysActor.Building = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply physics to the root prim
|
||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1829,13 +1842,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
pbs,
|
||||
newPart.AbsolutePosition,
|
||||
newPart.Scale,
|
||||
newPart.RotationOffset,
|
||||
//newPart.RotationOffset,
|
||||
newPart.GetWorldRotation(),
|
||||
part.PhysActor.IsPhysical,
|
||||
newPart.LocalId);
|
||||
|
||||
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
|
||||
}
|
||||
}
|
||||
if (dupe.m_rootPart.PhysActor != null && userExposed)
|
||||
dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
|
||||
|
||||
if (userExposed)
|
||||
{
|
||||
|
@ -2849,12 +2865,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
if (parts[i] != RootPart)
|
||||
parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
|
||||
}
|
||||
*/
|
||||
if (parts.Length > 1)
|
||||
{
|
||||
m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true);
|
||||
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
|
||||
if (parts[i].UUID != m_rootPart.UUID)
|
||||
parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true);
|
||||
}
|
||||
|
||||
if (m_rootPart.PhysActor != null)
|
||||
m_rootPart.PhysActor.Building = false;
|
||||
}
|
||||
else
|
||||
m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1503,7 +1503,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
/// <param name="rootObjectFlags"></param>
|
||||
/// <param name="VolumeDetectActive"></param>
|
||||
public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
|
||||
// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
|
||||
public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building)
|
||||
{
|
||||
if (!ParentGroup.Scene.CollidablePrims)
|
||||
return;
|
||||
|
@ -1557,6 +1558,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
PhysActor.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
if (!building)
|
||||
PhysActor.Building = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1792,6 +1795,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!isNew)
|
||||
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
|
||||
PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
|
||||
PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
|
||||
PhysActor.delink();
|
||||
|
@ -4268,7 +4275,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="SetTemporary"></param>
|
||||
/// <param name="SetPhantom"></param>
|
||||
/// <param name="SetVD"></param>
|
||||
public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
|
||||
// public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
|
||||
public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building)
|
||||
{
|
||||
bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
|
||||
bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
|
||||
|
@ -4286,6 +4294,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// that...
|
||||
// ... if VD is changed, all others are not.
|
||||
// ... if one of the others is changed, VD is not.
|
||||
// do this first
|
||||
if (building && PhysActor != null && PhysActor.Building != building)
|
||||
PhysActor.Building = building;
|
||||
if (SetVD) // VD is active, special logic applies
|
||||
{
|
||||
// State machine logic for VolumeDetect
|
||||
|
@ -4448,6 +4459,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
|
||||
|
||||
// and last in case we have a new actor and not building
|
||||
if (PhysActor != null && PhysActor.Building != building)
|
||||
PhysActor.Building = building;
|
||||
if (ParentGroup != null)
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
|
|
|
@ -2062,7 +2062,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
SetInStaticSpace(this);
|
||||
}
|
||||
|
||||
m_building = false; // REMOVE THIS LATER
|
||||
// m_building = false; // REMOVE THIS LATER
|
||||
|
||||
|
||||
if (m_isphysical && Body == IntPtr.Zero)
|
||||
|
|
Loading…
Reference in New Issue