Merge branch 'master' into 0.9.0-post-fixes

0.9.0-post-fixes
Diva Canto 2016-10-24 09:15:18 -07:00
commit 67677fe8db
13 changed files with 227 additions and 189 deletions

View File

@ -55,6 +55,9 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
bool IsChildAgent { get; } bool IsChildAgent { get; }
bool IsInTransit { get; }
bool isNPC { get;}
bool Invulnerable { get; set; } bool Invulnerable { get; set; }
/// <summary> /// <summary>
/// Avatar appearance data. /// Avatar appearance data.

View File

@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
{ {
m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue;
m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; // m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue;
m_thisAgentUpdateArgs.ControlFlags = 0;
AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
mov.SimData.ChannelVersion = m_channelVersion; mov.SimData.ChannelVersion = m_channelVersion;
@ -6172,8 +6173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Threshold for body rotation to be a significant agent update // Threshold for body rotation to be a significant agent update
// use the abs of cos // use the abs of cos
private const float QDELTABody = 1.0f - 0.0001f; private const float QDELTABody = 1.0f - 0.00005f;
private const float QDELTAHead = 1.0f - 0.0001f; private const float QDELTAHead = 1.0f - 0.00005f;
// Threshold for camera rotation to be a significant agent update // Threshold for camera rotation to be a significant agent update
private const float VDELTA = 0.01f; private const float VDELTA = 0.01f;
@ -6196,27 +6197,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name='x'></param> /// <param name='x'></param>
private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{ {
if(
(x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
// || ((x.ControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0 &&
// (x.ControlFlags & 0x3f8dfff) != 0) // we need to rotate the av on fly
|| x.ControlFlags != (byte)AgentManager.ControlFlags.NONE// actually all movement controls need to pass
|| (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
|| (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
|| (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed
)
return true;
float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
//qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
bool movementSignificant = if(
(x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed qdelta1 < QDELTABody // significant if body rotation above(below cos) threshold
|| (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
|| (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
|| (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
|| (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold
// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
// || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold // || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold
|| (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed )
; return true;
//if (movementSignificant)
//{ return false;
//m_log.DebugFormat("[LLCLIENTVIEW]: Bod {0} {1}",
// qdelta1, qdelta2);
//m_log.DebugFormat("[LLCLIENTVIEW]: St {0} {1} {2} {3}",
// x.ControlFlags, x.Flags, x.Far, x.State);
//}
return movementSignificant;
} }
/// <summary> /// <summary>
@ -6227,33 +6229,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name='x'></param> /// <param name='x'></param>
private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{ {
float vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
float vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); if((vdelta > VDELTA))
float vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); return true;
float vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
bool cameraSignificant = vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
(vdelta1 > VDELTA) || if((vdelta > VDELTA))
(vdelta2 > VDELTA) || return true;
(vdelta3 > VDELTA) ||
(vdelta4 > VDELTA)
;
//if (cameraSignificant) vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
//{ if((vdelta > VDELTA))
//m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}", return true;
// x.CameraAtAxis, x.CameraCenter);
//m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}",
// x.CameraLeftAxis, x.CameraUpAxis);
//}
return cameraSignificant; vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
if((vdelta > VDELTA))
return true;
return false;
} }
private bool HandleAgentUpdate(IClientAPI sender, Packet packet) private bool HandleAgentUpdate(IClientAPI sender, Packet packet)
{ {
// We got here, which means that something in agent update was significant
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData;
@ -6264,6 +6260,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
TotalAgentUpdates++; TotalAgentUpdates++;
// dont let ignored updates pollute this throttles
if(SceneAgent == null || SceneAgent.IsChildAgent || SceneAgent.IsInTransit)
{
// throttle reset is done at MoveAgentIntoRegion()
// called by scenepresence on completemovement
PacketPool.Instance.ReturnPacket(packet);
return true;
}
bool movement = CheckAgentMovementUpdateSignificance(x); bool movement = CheckAgentMovementUpdateSignificance(x);
bool camera = CheckAgentCameraUpdateSignificance(x); bool camera = CheckAgentCameraUpdateSignificance(x);
@ -6276,7 +6280,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_thisAgentUpdateArgs.Far = x.Far; m_thisAgentUpdateArgs.Far = x.Far;
m_thisAgentUpdateArgs.Flags = x.Flags; m_thisAgentUpdateArgs.Flags = x.Flags;
m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
// m_thisAgentUpdateArgs.SessionID = x.SessionID;
m_thisAgentUpdateArgs.State = x.State; m_thisAgentUpdateArgs.State = x.State;
UpdateAgent handlerAgentUpdate = OnAgentUpdate; UpdateAgent handlerAgentUpdate = OnAgentUpdate;
@ -6288,8 +6291,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerAgentUpdate != null) if (handlerAgentUpdate != null)
OnAgentUpdate(this, m_thisAgentUpdateArgs); OnAgentUpdate(this, m_thisAgentUpdateArgs);
handlerAgentUpdate = null;
handlerPreAgentUpdate = null;
} }
// Was there a significant camera(s) change? // Was there a significant camera(s) change?
@ -6305,7 +6306,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerAgentCameraUpdate != null) if (handlerAgentCameraUpdate != null)
handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
handlerAgentCameraUpdate = null;
} }
PacketPool.Instance.ReturnPacket(packet); PacketPool.Instance.ReturnPacket(packet);

View File

@ -212,7 +212,6 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelReclaim += ClientOnParcelReclaim;
client.OnParcelInfoRequest += ClientOnParcelInfoRequest; client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
client.OnParcelEjectUser += ClientOnParcelEjectUser; client.OnParcelEjectUser += ClientOnParcelEjectUser;
client.OnParcelFreezeUser += ClientOnParcelFreezeUser; client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
client.OnSetStartLocationRequest += ClientOnSetHome; client.OnSetStartLocationRequest += ClientOnSetHome;
@ -223,10 +222,6 @@ namespace OpenSim.Region.CoreModules.World.Land
avatar.currentParcelUUID = UUID.Zero; avatar.currentParcelUUID = UUID.Zero;
} }
void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
}
public void Close() public void Close()
{ {
} }

View File

@ -341,10 +341,16 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
// Normal Calculations // Normal Calculations
int parcelMax = (int)( (long)LandData.Area int parcelMax = (int)(
* (long)m_scene.RegionInfo.ObjectCapacity (double)LandData.Area
* (long)m_scene.RegionInfo.RegionSettings.ObjectBonus * (double)m_scene.RegionInfo.ObjectCapacity
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); * (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (double)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
+ 0.5 );
if(parcelMax > m_scene.RegionInfo.ObjectCapacity)
parcelMax = m_scene.RegionInfo.ObjectCapacity;
//m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax); //m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax);
return parcelMax; return parcelMax;
} }
@ -359,9 +365,14 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
//Normal Calculations //Normal Calculations
int simMax = (int)( (long)LandData.SimwideArea int simMax = (int)( (double)LandData.SimwideArea
* (long)m_scene.RegionInfo.ObjectCapacity * (double)m_scene.RegionInfo.ObjectCapacity
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); * (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
+0.5 );
if(simMax > m_scene.RegionInfo.ObjectCapacity)
simMax = m_scene.RegionInfo.ObjectCapacity;
//m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}", //m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}",
// LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax, LandData.SimwidePrims); // LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax, LandData.SimwidePrims);
return simMax; return simMax;

View File

@ -274,50 +274,46 @@ namespace OpenSim.Region.Framework.Scenes
private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity) private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity)
{ {
uint pqueue = 2; // keep compiler happy
ScenePresence presence = m_scene.GetScenePresence(client.AgentId); ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
if (presence == null) if (presence == null)
return PriorityQueue.NumberOfQueues - 1; return PriorityQueue.NumberOfQueues - 1;
// All avatars other than our own go into pqueue 1 uint pqueue = ComputeAngleDistancePriority(presence, entity);
if (entity is ScenePresence)
return 1;
if (entity is SceneObjectPart)
{
// Attachments are high priority,
if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
return 2;
pqueue = ComputeAngleDistancePriority(presence, entity);
// Non physical prims are lower priority than physical prims
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
if (physActor == null || !physActor.IsPhysical)
pqueue++;
}
return pqueue; return pqueue;
} }
private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity) private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity)
{ {
double distance; // And convert the distance to a priority queue, this computation gives queues
// at 10, 20, 40, 80, 160, 320, 640, and 1280m
// uint minpqueue = PriorityQueue.NumberOfImmediateQueues;
uint maxqueue = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues -1;
// uint pqueue = minpqueue;
uint pqueue = PriorityQueue.NumberOfImmediateQueues;
float distance;
Vector3 presencePos = presence.AbsolutePosition; Vector3 presencePos = presence.AbsolutePosition;
if(entity is ScenePresence)
{
ScenePresence sp = entity as ScenePresence;
distance = Vector3.Distance(presencePos, sp.AbsolutePosition);
distance *= 0.5f;
}
else
{
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
float bradius = group.GetBoundsRadius(); float bradius = group.GetBoundsRadius();
Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter();
distance = Vector3.Distance(presencePos, grppos); distance = Vector3.Distance(presencePos, grppos);
distance -= bradius; distance -= bradius;
distance *= group.getAreaFactor(); distance *= group.getAreaFactor();
if(group.IsAttachment)
// And convert the distance to a priority queue, this computation gives queues distance *= 0.5f;
// at 10, 20, 40, 80, 160, 320, 640, and 1280m else if(group.UsesPhysics)
uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue distance *= 0.6f;
uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; else if(group.GetSittingAvatarsCount() > 0)
distance *= 0.5f;
}
if (distance > 10f) if (distance > 10f)
{ {
@ -328,8 +324,8 @@ namespace OpenSim.Region.Framework.Scenes
// 2st constant makes it be log2(distance/10) // 2st constant makes it be log2(distance/10)
pqueue += (uint)tmp; pqueue += (uint)tmp;
if (pqueue > queues - 1) if (pqueue > maxqueue)
pqueue = queues - 1; pqueue = maxqueue;
} }
return pqueue; return pqueue;

View File

@ -3869,15 +3869,11 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
if (part.Scale.X > m_scene.m_maxPhys ||
part.Scale.Y > m_scene.m_maxPhys ||
part.Scale.Z > m_scene.m_maxPhys )
{
UsePhysics = false; // Reset physics
break;
}
if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None) if(part.PhysicsShapeType == (byte)PhysicsShapeType.None)
continue; // assuming root type was checked elsewhere
if (checkShape)
{ {
if (--maxprims < 0) if (--maxprims < 0)
{ {
@ -3885,6 +3881,14 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
} }
} }
if (part.Scale.X > m_scene.m_maxPhys ||
part.Scale.Y > m_scene.m_maxPhys ||
part.Scale.Z > m_scene.m_maxPhys )
{
UsePhysics = false; // Reset physics
break;
}
} }
} }

View File

@ -281,7 +281,9 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_followCamAuto = false; private bool m_followCamAuto = false;
private Vector3? m_forceToApply; // private object m_forceToApplyLock = new object();
// private bool m_forceToApplyValid;
// private Vector3 m_forceToApply;
private int m_userFlags; private int m_userFlags;
public int UserFlags public int UserFlags
{ {
@ -2120,6 +2122,7 @@ namespace OpenSim.Region.Framework.Scenes
if (haveAnims) if (haveAnims)
SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
// we should be able to receive updates, etc // we should be able to receive updates, etc
// so release them // so release them
m_inTransit = false; m_inTransit = false;
@ -2238,6 +2241,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
finally finally
{ {
haveGroupInformation = false;
gotCrossUpdate = false;
crossingFlags = 0;
m_inTransit = false; m_inTransit = false;
} }
// if hide force a check // if hide force a check
@ -2247,9 +2253,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_currentParcelHide = newhide; // m_currentParcelHide = newhide;
// } // }
haveGroupInformation = false;
gotCrossUpdate = false;
crossingFlags = 0;
m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
@ -3006,7 +3009,8 @@ namespace OpenSim.Region.Framework.Scenes
MovingToTarget = false; MovingToTarget = false;
// MoveToPositionTarget = Vector3.Zero; // MoveToPositionTarget = Vector3.Zero;
m_forceToApply = null; // cancel possible last action // lock(m_forceToApplyLock)
// m_forceToApplyValid = false; // cancel possible last action
// We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
// resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
@ -3638,8 +3642,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
// m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name);
/*
lock(m_forceToApplyLock)
{
m_forceToApply = direc; m_forceToApply = direc;
m_forceToApplyValid = true;
}
*/
Velocity = direc;
Animator.UpdateMovementAnimations(); Animator.UpdateMovementAnimations();
} }
@ -4734,18 +4744,22 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void UpdateMovement() public void UpdateMovement()
{ {
/*
if (IsInTransit) if (IsInTransit)
return; return;
if (m_forceToApply.HasValue)
lock(m_forceToApplyLock)
{ {
Vector3 force = m_forceToApply.Value; if (m_forceToApplyValid)
{
Velocity = m_forceToApply;
Velocity = force; m_forceToApplyValid = false;
m_forceToApply = null;
TriggerScenePresenceUpdated(); TriggerScenePresenceUpdated();
} }
} }
*/
}
/// <summary> /// <summary>
/// Adds a physical representation of the avatar to the Physics plugin /// Adds a physical representation of the avatar to the Physics plugin
@ -4767,6 +4781,9 @@ namespace OpenSim.Region.Framework.Scenes
// Appearance.SetHeight(); // Appearance.SetHeight();
Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
// lock(m_forceToApplyLock)
// m_forceToApplyValid = false;
PhysicsScene scene = m_scene.PhysicsScene; PhysicsScene scene = m_scene.PhysicsScene;
Vector3 pVec = AbsolutePosition; Vector3 pVec = AbsolutePosition;

View File

@ -186,8 +186,8 @@ namespace OpenSim.Region.OptionalModules
{ {
string response = null; string response = null;
int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity) if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{ {
response = "Unable to rez object because the parcel is too full"; response = "Unable to rez object because the parcel is too full";
} }

View File

@ -52,7 +52,6 @@ public sealed class BSCharacter : BSPhysObject
private bool _setAlwaysRun; private bool _setAlwaysRun;
private bool _throttleUpdates; private bool _throttleUpdates;
private bool _floatOnWater; private bool _floatOnWater;
private OMV.Vector3 _rotationalVelocity;
private bool _kinematic; private bool _kinematic;
private float _buoyancy; private float _buoyancy;
@ -291,7 +290,7 @@ public sealed class BSCharacter : BSPhysObject
{ {
RawVelocity = OMV.Vector3.Zero; RawVelocity = OMV.Vector3.Zero;
_acceleration = OMV.Vector3.Zero; _acceleration = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero; RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties directly into the physics engine // Zero some other properties directly into the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate() PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate()
@ -303,7 +302,7 @@ public sealed class BSCharacter : BSPhysObject
public override void ZeroAngularMotion(bool inTaintTime) public override void ZeroAngularMotion(bool inTaintTime)
{ {
_rotationalVelocity = OMV.Vector3.Zero; RawRotationalVelocity = OMV.Vector3.Zero;
PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate() PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate()
{ {
@ -351,7 +350,6 @@ public sealed class BSCharacter : BSPhysObject
} }
} }
// Check that the current position is sane and, if not, modify the position to make it so. // Check that the current position is sane and, if not, modify the position to make it so.
// Check for being below terrain or on water. // Check for being below terrain or on water.
// Returns 'true' of the position was made sane by some action. // Returns 'true' of the position was made sane by some action.
@ -503,6 +501,17 @@ public sealed class BSCharacter : BSPhysObject
} }
} }
// SetMomentum just sets the velocity without a target. We need to stop the movement actor if a character.
public override void SetMomentum(OMV.Vector3 momentum)
{
if (m_moveActor != null)
{
m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */);
}
base.SetMomentum(momentum);
}
public override OMV.Vector3 Torque { public override OMV.Vector3 Torque {
get { return RawTorque; } get { return RawTorque; }
set { RawTorque = value; set { RawTorque = value;
@ -618,14 +627,6 @@ public sealed class BSCharacter : BSPhysObject
}); });
} }
} }
public override OMV.Vector3 RotationalVelocity {
get { return _rotationalVelocity; }
set { _rotationalVelocity = value; }
}
public override OMV.Vector3 ForceRotationalVelocity {
get { return _rotationalVelocity; }
set { _rotationalVelocity = value; }
}
public override bool Kinematic { public override bool Kinematic {
get { return _kinematic; } get { return _kinematic; }
set { _kinematic = value; } set { _kinematic = value; }
@ -716,8 +717,6 @@ public sealed class BSCharacter : BSPhysObject
public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) { public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) {
} }
public override void SetMomentum(OMV.Vector3 momentum) {
}
// The avatar's physical shape (whether capsule or cube) is unit sized. BulletSim sets // The avatar's physical shape (whether capsule or cube) is unit sized. BulletSim sets
// the scale of that unit shape to create the avatars full size. // the scale of that unit shape to create the avatars full size.
@ -841,7 +840,7 @@ public sealed class BSCharacter : BSPhysObject
RawVelocity = entprop.Velocity; RawVelocity = entprop.Velocity;
_acceleration = entprop.Acceleration; _acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity; RawRotationalVelocity = entprop.RotationalVelocity;
// Do some sanity checking for the avatar. Make sure it's above ground and inbounds. // Do some sanity checking for the avatar. Make sure it's above ground and inbounds.
if (PositionSanityCheck(true)) if (PositionSanityCheck(true))
@ -861,7 +860,7 @@ public sealed class BSCharacter : BSPhysObject
// PhysScene.PostUpdate(this); // PhysScene.PostUpdate(this);
DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity); LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, RawRotationalVelocity);
} }
} }
} }

View File

@ -239,6 +239,8 @@ public abstract class BSPhysObject : PhysicsActor
public virtual OMV.Vector3 RawVelocity { get; set; } public virtual OMV.Vector3 RawVelocity { get; set; }
public abstract OMV.Vector3 ForceVelocity { get; set; } public abstract OMV.Vector3 ForceVelocity { get; set; }
public OMV.Vector3 RawRotationalVelocity { get; set; }
// RawForce is a constant force applied to object (see Force { set; } ) // RawForce is a constant force applied to object (see Force { set; } )
public OMV.Vector3 RawForce { get; set; } public OMV.Vector3 RawForce { get; set; }
public OMV.Vector3 RawTorque { get; set; } public OMV.Vector3 RawTorque { get; set; }
@ -250,7 +252,48 @@ public abstract class BSPhysObject : PhysicsActor
public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force);
public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); public abstract void AddForce(bool inTaintTime, OMV.Vector3 force);
public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } // PhysicsActor.SetMomentum
// All the physics engined use this as a way of forcing the velocity to something.
public override void SetMomentum(OMV.Vector3 momentum)
{
// This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor)
RawVelocity = momentum;
PhysScene.TaintedObject(LocalID, TypeName + ".SetMomentum", delegate()
{
// DetailLog("{0},BSPrim.SetMomentum,taint,vel={1}", LocalID, RawVelocity);
ForceVelocity = RawVelocity;
});
}
public override OMV.Vector3 RotationalVelocity {
get {
return RawRotationalVelocity;
}
set {
RawRotationalVelocity = value;
Util.ClampV(RawRotationalVelocity, BSParam.MaxAngularVelocity);
// m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
PhysScene.TaintedObject(LocalID, TypeName + ".setRotationalVelocity", delegate()
{
ForceRotationalVelocity = RawRotationalVelocity;
});
}
}
public OMV.Vector3 ForceRotationalVelocity {
get {
return RawRotationalVelocity;
}
set {
RawRotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity);
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},{1}.ForceRotationalVel,taint,rotvel={2}", LocalID, TypeName, RawRotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity);
// PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
ActivateIfPhysical(false);
}
}
}
public abstract float ForceBuoyancy { get; set; } public abstract float ForceBuoyancy { get; set; }
@ -582,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor
{ {
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}",
LocalID, TypeName, ms, CurrentCollisionFlags); LocalID, TypeName, SubscribedEventsMs, CurrentCollisionFlags);
} }
}); });
} }

View File

@ -59,7 +59,6 @@ public class BSPrim : BSPhysObject
private bool _setAlwaysRun; private bool _setAlwaysRun;
private bool _throttleUpdates; private bool _throttleUpdates;
private bool _floatOnWater; private bool _floatOnWater;
private OMV.Vector3 _rotationalVelocity;
private bool _kinematic; private bool _kinematic;
private float _buoyancy; private float _buoyancy;
@ -90,7 +89,7 @@ public class BSPrim : BSPhysObject
RawOrientation = rotation; RawOrientation = rotation;
_buoyancy = 0f; _buoyancy = 0f;
RawVelocity = OMV.Vector3.Zero; RawVelocity = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero; RawRotationalVelocity = OMV.Vector3.Zero;
BaseShape = pbs; BaseShape = pbs;
_isPhysical = pisPhysical; _isPhysical = pisPhysical;
_isVolumeDetect = false; _isVolumeDetect = false;
@ -256,7 +255,7 @@ public class BSPrim : BSPhysObject
{ {
RawVelocity = OMV.Vector3.Zero; RawVelocity = OMV.Vector3.Zero;
_acceleration = OMV.Vector3.Zero; _acceleration = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero; RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine // Zero some other properties in the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate() PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
@ -267,15 +266,15 @@ public class BSPrim : BSPhysObject
} }
public override void ZeroAngularMotion(bool inTaintTime) public override void ZeroAngularMotion(bool inTaintTime)
{ {
_rotationalVelocity = OMV.Vector3.Zero; RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine // Zero some other properties in the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate() PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
{ {
// DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
if (PhysBody.HasPhysicalBody) if (PhysBody.HasPhysicalBody)
{ {
PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, RawRotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity);
} }
}); });
} }
@ -426,9 +425,9 @@ public class BSPrim : BSPhysObject
RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity);
ret = true; ret = true;
} }
if (_rotationalVelocity.LengthSquared() > BSParam.MaxAngularVelocitySquared) if (RawRotationalVelocity.LengthSquared() > BSParam.MaxAngularVelocitySquared)
{ {
_rotationalVelocity = Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); RawRotationalVelocity = Util.ClampV(RawRotationalVelocity, BSParam.MaxAngularVelocity);
ret = true; ret = true;
} }
@ -1008,7 +1007,7 @@ public class BSPrim : BSPhysObject
// For good measure, make sure the transform is set through to the motion state // For good measure, make sure the transform is set through to the motion state
ForcePosition = RawPosition; ForcePosition = RawPosition;
ForceVelocity = RawVelocity; ForceVelocity = RawVelocity;
ForceRotationalVelocity = _rotationalVelocity; ForceRotationalVelocity = RawRotationalVelocity;
// A dynamic object has mass // A dynamic object has mass
UpdatePhysicalMassProperties(RawMass, false); UpdatePhysicalMassProperties(RawMass, false);
@ -1128,35 +1127,6 @@ public class BSPrim : BSPhysObject
}); });
} }
} }
public override OMV.Vector3 RotationalVelocity {
get {
return _rotationalVelocity;
}
set {
_rotationalVelocity = value;
Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity);
// m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
PhysScene.TaintedObject(LocalID, "BSPrim.setRotationalVelocity", delegate()
{
ForceRotationalVelocity = _rotationalVelocity;
});
}
}
public override OMV.Vector3 ForceRotationalVelocity {
get {
return _rotationalVelocity;
}
set {
_rotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity);
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
// PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
ActivateIfPhysical(false);
}
}
}
public override bool Kinematic { public override bool Kinematic {
get { return _kinematic; } get { return _kinematic; }
set { _kinematic = value; set { _kinematic = value;
@ -1358,9 +1328,6 @@ public class BSPrim : BSPhysObject
}); });
} }
public override void SetMomentum(OMV.Vector3 momentum) {
// DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum);
}
#region Mass Calculation #region Mass Calculation
private float CalculateMass() private float CalculateMass()
@ -1930,7 +1897,7 @@ public class BSPrim : BSPhysObject
if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold)) if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold))
RawVelocity = entprop.Velocity; RawVelocity = entprop.Velocity;
_acceleration = entprop.Acceleration; _acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity; RawRotationalVelocity = entprop.RotationalVelocity;
// DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
@ -1939,7 +1906,7 @@ public class BSPrim : BSPhysObject
{ {
entprop.Position = RawPosition; entprop.Position = RawPosition;
entprop.Velocity = RawVelocity; entprop.Velocity = RawVelocity;
entprop.RotationalVelocity = _rotationalVelocity; entprop.RotationalVelocity = RawRotationalVelocity;
entprop.Acceleration = _acceleration; entprop.Acceleration = _acceleration;
} }

View File

@ -894,7 +894,7 @@
;; The trade-off may be increased memory usage by the script engine. ;; The trade-off may be increased memory usage by the script engine.
; ThreadStackSize = 262144 ; ThreadStackSize = 262144
;; Set this to true (the default) to load each script into a separate ;; Set this to true to load each script into a separate
;; AppDomain. ;; AppDomain.
;; ;;
;; Setting this to false will load all script assemblies into the ;; Setting this to false will load all script assemblies into the
@ -903,8 +903,10 @@
;; ;;
;; However, setting this to false will also prevent script DLLs from being unloaded from memory if the script is deleted. ;; However, setting this to false will also prevent script DLLs from being unloaded from memory if the script is deleted.
;; This may cause an OutOfMemory problem over time when avatars with scripted attachments move in and out of the region. ;; This may cause an OutOfMemory problem over time when avatars with scripted attachments move in and out of the region.
;; Some Windows users have also reported script loading problems when AppDomainLoading = false ;; at this time some mono versions seem to have problems with the true option
; AppDomainLoading = true ;; so default is now false until a fix is found, to simply life of less technical skilled users.
;; this should only be a issue if regions stay alive for a long time with lots of scripts added or edited.
; AppDomainLoading = false
;; Controls whether scripts are stopped by aborting their threads externally (abort) or by co-operative checks from the compiled script (co-op) ;; Controls whether scripts are stopped by aborting their threads externally (abort) or by co-operative checks from the compiled script (co-op)
;; co-op will be more stable but this option is currently experimental. ;; co-op will be more stable but this option is currently experimental.

View File

@ -293,7 +293,7 @@
;; OpenDynamicsEngine was the previous default physics engine in OpenSimulator 0.7.6.1 and before. ;; OpenDynamicsEngine was the previous default physics engine in OpenSimulator 0.7.6.1 and before.
;; It continues to provide a workable physics implementation. It does not currently support varregions. ;; It continues to provide a workable physics implementation. It does not currently support varregions.
;; basicphysics effectively does not model physics at all, making all objects phantom. ;; basicphysics effectively does not model physics at all, making all objects phantom.
;; Default is OpenDynamicsEngine ;; Default is BulletSim
physics = BulletSim physics = BulletSim
;physics = modified_BulletX ;physics = modified_BulletX
;physics = OpenDynamicsEngine ;physics = OpenDynamicsEngine
@ -1690,12 +1690,13 @@
; Stack size per thread created ; Stack size per thread created
ThreadStackSize = 262144 ThreadStackSize = 262144
; Set this to true (the default) to load each script into a separate ; Set this to true to load each script into a separate
; AppDomain. Setting this to false will load all script assemblies into the ; AppDomain. Setting this to false will load all script assemblies into the
; current AppDomain, which will reduce the per-script overhead at the ; current AppDomain, which will reduce the per-script overhead but deleted scripts stay inactive using memory
; expense of reduced security and the inability to garbage collect the ; this may only be a problem if regions stay alive for a long time with lots of scripts added or edited.
; script assemblies ; at this time some mono versions seem to have problems with the true option
AppDomainLoading = true ; so default is now false until a fix is found
AppDomainLoading = false
; Controls whether previously compiled scripts DLLs are deleted on sim restart. If you set this to false ; Controls whether previously compiled scripts DLLs are deleted on sim restart. If you set this to false
; then startup will be considerably faster since scripts won't need to be recompiled. However, then it becomes your responsibility to delete the ; then startup will be considerably faster since scripts won't need to be recompiled. However, then it becomes your responsibility to delete the