changed - VolumeDetect and phantom setting interaction. Script VD(true) forces phantom ON. UI phantom off turns off VD. Other transitions should only change specific parameter. This is not as current SL. - Fixed volumedetect prims being wrongly removed from physics.

avinationmerge
UbitUmarov 2012-04-19 23:01:22 +01:00
parent 9b02e1cf4a
commit aeb5aed5b7
2 changed files with 40 additions and 13 deletions

View File

@ -1516,8 +1516,18 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
// VolumeDetect can't be set via UI and will always be off when a change is made there // VolumeDetect can't be set via UI and will always be off when a change is made there
if (PhysData.PhysShapeType == PhysShapeType.invalid) // now only change volume dtc if phantom off
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
{
bool vdtc;
if (SetPhantom) // if phantom keep volumedtc
vdtc = group.RootPart.VolumeDetectActive;
else // else turn it off
vdtc = false;
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc);
}
else else
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);

View File

@ -1830,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building) public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
{ {
VolumeDetectActive = _VolumeDetectActive; //?? as is used this is redundante VolumeDetectActive = _VolumeDetectActive;
if (!ParentGroup.Scene.CollidablePrims) if (!ParentGroup.Scene.CollidablePrims)
return; return;
@ -1839,7 +1839,10 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0; bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0;
bool isPhantom = (_ObjectFlags & (uint) PrimFlags.Phantom) != 0; bool isPhantom = (_ObjectFlags & (uint)PrimFlags.Phantom) != 0;
if (_VolumeDetectActive)
isPhantom = true;
if (IsJoint()) if (IsJoint())
{ {
@ -2065,6 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Do a physics propery update for this part. /// Do a physics propery update for this part.
/// now also updates phantom and volume detector
/// </summary> /// </summary>
/// <param name="UsePhysics"></param> /// <param name="UsePhysics"></param>
/// <param name="isNew"></param> /// <param name="isNew"></param>
@ -2096,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.RootPart == this) if (ParentGroup.RootPart == this)
AngularVelocity = new Vector3(0, 0, 0); AngularVelocity = new Vector3(0, 0, 0);
if (pa.Phantom) if (pa.Phantom && !VolumeDetectActive)
{ {
RemoveFromPhysics(); RemoveFromPhysics();
return; return;
@ -2143,6 +2147,14 @@ namespace OpenSim.Region.Framework.Scenes
if (pa.Phantom != phan) if (pa.Phantom != phan)
pa.Phantom = phan; pa.Phantom = phan;
// some engines dont' have this check still
// if (VolumeDetectActive != pa.IsVolumeDtc)
{
if (VolumeDetectActive)
pa.SetVolumeDetect(1);
else
pa.SetVolumeDetect(0);
}
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
// mesh data. // mesh data.
@ -4599,6 +4611,12 @@ namespace OpenSim.Region.Framework.Scenes
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
return; return;
VolumeDetectActive = SetVD;
// volume detector implies phantom
if (VolumeDetectActive)
SetPhantom = true;
if (UsePhysics) if (UsePhysics)
AddFlag(PrimFlags.Physics); AddFlag(PrimFlags.Physics);
else else
@ -4614,7 +4632,6 @@ namespace OpenSim.Region.Framework.Scenes
else else
RemFlag(PrimFlags.TemporaryOnRez); RemFlag(PrimFlags.TemporaryOnRez);
VolumeDetectActive = SetVD;
if (ParentGroup.Scene == null) if (ParentGroup.Scene == null)
return; return;
@ -4624,7 +4641,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null && building && pa.Building != building) if (pa != null && building && pa.Building != building)
pa.Building = building; pa.Building = building;
if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
|| (Shape.PathCurve == (byte)Extrusion.Flexible)) || (Shape.PathCurve == (byte)Extrusion.Flexible))
{ {
if (pa != null) if (pa != null)
@ -4669,12 +4686,12 @@ namespace OpenSim.Region.Framework.Scenes
else // it already has a physical representation else // it already has a physical representation
{ {
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
/* moved into DoPhysicsPropertyUpdate
if(VolumeDetectActive) if(VolumeDetectActive)
pa.SetVolumeDetect(1); pa.SetVolumeDetect(1);
else else
pa.SetVolumeDetect(0); pa.SetVolumeDetect(0);
*/
if (pa.Building != building) if (pa.Building != building)
pa.Building = building; pa.Building = building;
} }