only add a prim to physics in PhysicsShapeType if changing from type none. when viewers change ExtraPhysics parameters, send back the new values.

melanie
UbitUmarov 2016-11-02 21:42:32 +00:00
parent 7c4f2b048f
commit 9480da06b9
3 changed files with 51 additions and 65 deletions

View File

@ -2920,7 +2920,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString());
} }
part.UpdatePhysRequired = false;
} }
} }

View File

@ -1660,7 +1660,7 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null) if (part != null)
{ {
part.UpdateExtraPhysics(PhysData); part.UpdateExtraPhysics(PhysData);
if (part.UpdatePhysRequired && remoteClient != null) if (remoteClient != null)
remoteClient.SendPartPhysicsProprieties(part); remoteClient.SendPartPhysicsProprieties(part);
} }
} }

View File

@ -1222,7 +1222,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
public UpdateRequired UpdateFlag { get; set; } public UpdateRequired UpdateFlag { get; set; }
public bool UpdatePhysRequired { get; set; }
/// <summary> /// <summary>
/// Used for media on a prim. /// Used for media on a prim.
@ -1637,7 +1636,6 @@ namespace OpenSim.Region.Framework.Scenes
if(ParentGroup != null) if(ParentGroup != null)
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
ScheduleFullUpdateIfNone(); ScheduleFullUpdateIfNone();
UpdatePhysRequired = true;
} }
} }
} }
@ -1729,7 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
byte oldv = m_physicsShapeType; byte oldv = m_physicsShapeType;
if (value >= 0 && value <= (byte)PhysShapeType.convex) if (value >= 0 && value <= (byte)PhysShapeType.convex)
{ {
if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
@ -1748,28 +1746,21 @@ namespace OpenSim.Region.Framework.Scenes
{ {
ParentGroup.Scene.RemovePhysicalPrim(1); ParentGroup.Scene.RemovePhysicalPrim(1);
RemoveFromPhysics(); RemoveFromPhysics();
Stop(); // Stop();
} }
} }
else if (PhysActor == null) else if (PhysActor == null)
{ {
ApplyPhysics((uint)Flags, VolumeDetectActive, false); if(oldv == (byte)PhysShapeType.none)
UpdatePhysicsSubscribedEvents(); {
ApplyPhysics((uint)Flags, VolumeDetectActive, false);
UpdatePhysicsSubscribedEvents();
}
} }
else else
{
PhysActor.PhysicsShapeType = m_physicsShapeType; PhysActor.PhysicsShapeType = m_physicsShapeType;
// if (Shape.SculptEntry)
// CheckSculptAndLoad();
}
if (ParentGroup != null) ParentGroup.HasGroupChanged = true;
ParentGroup.HasGroupChanged = true;
}
if (m_physicsShapeType != value)
{
UpdatePhysRequired = true;
} }
} }
} }
@ -1782,17 +1773,16 @@ namespace OpenSim.Region.Framework.Scenes
if (value >=1 && value <= 22587.0) if (value >=1 && value <= 22587.0)
{ {
m_density = value; m_density = value;
UpdatePhysRequired = true;
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Density = m_density;
} }
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Density = Density;
} }
} }
@ -1804,17 +1794,16 @@ namespace OpenSim.Region.Framework.Scenes
if( value >= -1 && value <=28.0f) if( value >= -1 && value <=28.0f)
{ {
m_gravitymod = value; m_gravitymod = value;
UpdatePhysRequired = true;
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.GravModifier = m_gravitymod;
} }
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.GravModifier = GravityModifier;
} }
} }
@ -1826,17 +1815,16 @@ namespace OpenSim.Region.Framework.Scenes
if (value >= 0 && value <= 255.0f) if (value >= 0 && value <= 255.0f)
{ {
m_friction = value; m_friction = value;
UpdatePhysRequired = true;
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Friction = m_friction;
} }
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Friction = Friction;
} }
} }
@ -1848,17 +1836,16 @@ namespace OpenSim.Region.Framework.Scenes
if (value >= 0 && value <= 1.0f) if (value >= 0 && value <= 1.0f)
{ {
m_bounce = value; m_bounce = value;
UpdatePhysRequired = true;
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Restitution = m_bounce;
} }
ScheduleFullUpdateIfNone();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
PhysicsActor pa = PhysActor;
if (pa != null)
pa.Restitution = Restitution;
} }
} }
@ -4541,24 +4528,24 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
} }
} }
public void UpdateExtraPhysics(ExtraPhysicsData physdata) public void UpdateExtraPhysics(ExtraPhysicsData physdata)
{ {
if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
return; return;
if (PhysicsShapeType != (byte)physdata.PhysShapeType) byte newtype = (byte)physdata.PhysShapeType;
{ if (PhysicsShapeType != newtype)
PhysicsShapeType = (byte)physdata.PhysShapeType; PhysicsShapeType = newtype;
}
if(Density != physdata.Density) if(Density != physdata.Density)
Density = physdata.Density; Density = physdata.Density;
if(GravityModifier != physdata.GravitationModifier) if(GravityModifier != physdata.GravitationModifier)
GravityModifier = physdata.GravitationModifier; GravityModifier = physdata.GravitationModifier;
if(Friction != physdata.Friction) if(Friction != physdata.Friction)
Friction = physdata.Friction; Friction = physdata.Friction;
if(Restitution != physdata.Bounce) if(Restitution != physdata.Bounce)
Restitution = physdata.Bounce; Restitution = physdata.Bounce;
} }