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;
} }
} }
} }
@ -1748,29 +1746,22 @@ 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)
{
if(oldv == (byte)PhysShapeType.none)
{ {
ApplyPhysics((uint)Flags, VolumeDetectActive, false); ApplyPhysics((uint)Flags, VolumeDetectActive, false);
UpdatePhysicsSubscribedEvents(); 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,8 +1773,6 @@ 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(); ScheduleFullUpdateIfNone();
@ -1792,7 +1781,8 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
pa.Density = Density; pa.Density = m_density;
}
} }
} }
@ -1804,8 +1794,6 @@ 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(); ScheduleFullUpdateIfNone();
@ -1814,7 +1802,8 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
pa.GravModifier = GravityModifier; pa.GravModifier = m_gravitymod;
}
} }
} }
@ -1826,8 +1815,6 @@ 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(); ScheduleFullUpdateIfNone();
@ -1836,7 +1823,8 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
pa.Friction = Friction; pa.Friction = m_friction;
}
} }
} }
@ -1848,8 +1836,6 @@ 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(); ScheduleFullUpdateIfNone();
@ -1858,7 +1844,8 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
pa.Restitution = Restitution; pa.Restitution = m_bounce;
}
} }
} }
@ -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;
} }