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>
bool IsChildAgent { get; }
bool IsInTransit { get; }
bool isNPC { get;}
bool Invulnerable { get; set; }
/// <summary>
/// Avatar appearance data.

View File

@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
{
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);
mov.SimData.ChannelVersion = m_channelVersion;
@ -6172,8 +6173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Threshold for body rotation to be a significant agent update
// use the abs of cos
private const float QDELTABody = 1.0f - 0.0001f;
private const float QDELTAHead = 1.0f - 0.0001f;
private const float QDELTABody = 1.0f - 0.00005f;
private const float QDELTAHead = 1.0f - 0.00005f;
// Threshold for camera rotation to be a significant agent update
private const float VDELTA = 0.01f;
@ -6196,27 +6197,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name='x'></param>
private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{
float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
//qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
bool movementSignificant =
if(
(x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
|| (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
// || ((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
|| (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
// || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold
|| (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed
;
//if (movementSignificant)
//{
//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;
)
return true;
float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
//qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
if(
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
// || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold
)
return true;
return false;
}
/// <summary>
@ -6227,33 +6229,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name='x'></param>
private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
{
float vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
float vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
float vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
float vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
if((vdelta > VDELTA))
return true;
bool cameraSignificant =
(vdelta1 > VDELTA) ||
(vdelta2 > VDELTA) ||
(vdelta3 > VDELTA) ||
(vdelta4 > VDELTA)
;
vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
if((vdelta > VDELTA))
return true;
//if (cameraSignificant)
//{
//m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}",
// x.CameraAtAxis, x.CameraCenter);
//m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}",
// x.CameraLeftAxis, x.CameraUpAxis);
//}
vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
if((vdelta > VDELTA))
return true;
return cameraSignificant;
vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
if((vdelta > VDELTA))
return true;
return false;
}
private bool HandleAgentUpdate(IClientAPI sender, Packet packet)
{
// We got here, which means that something in agent update was significant
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData;
@ -6264,10 +6260,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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 camera = CheckAgentCameraUpdateSignificance(x);
// Was there a significant movement/state change?
if (movement)
{
@ -6276,7 +6280,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_thisAgentUpdateArgs.Far = x.Far;
m_thisAgentUpdateArgs.Flags = x.Flags;
m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
// m_thisAgentUpdateArgs.SessionID = x.SessionID;
m_thisAgentUpdateArgs.State = x.State;
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
@ -6287,9 +6290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerAgentUpdate != null)
OnAgentUpdate(this, m_thisAgentUpdateArgs);
handlerAgentUpdate = null;
handlerPreAgentUpdate = null;
}
// Was there a significant camera(s) change?
@ -6305,7 +6306,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerAgentCameraUpdate != null)
handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
handlerAgentCameraUpdate = null;
}
PacketPool.Instance.ReturnPacket(packet);

View File

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

View File

@ -341,10 +341,16 @@ namespace OpenSim.Region.CoreModules.World.Land
else
{
// Normal Calculations
int parcelMax = (int)( (long)LandData.Area
* (long)m_scene.RegionInfo.ObjectCapacity
* (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
int parcelMax = (int)(
(double)LandData.Area
* (double)m_scene.RegionInfo.ObjectCapacity
* (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);
return parcelMax;
}
@ -359,9 +365,14 @@ namespace OpenSim.Region.CoreModules.World.Land
else
{
//Normal Calculations
int simMax = (int)( (long)LandData.SimwideArea
* (long)m_scene.RegionInfo.ObjectCapacity
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
int simMax = (int)( (double)LandData.SimwideArea
* (double)m_scene.RegionInfo.ObjectCapacity
* (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}",
// LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax, LandData.SimwidePrims);
return simMax;

View File

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

View File

@ -3869,15 +3869,11 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; 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)
{
@ -3885,6 +3881,14 @@ namespace OpenSim.Region.Framework.Scenes
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 Vector3? m_forceToApply;
// private object m_forceToApplyLock = new object();
// private bool m_forceToApplyValid;
// private Vector3 m_forceToApply;
private int m_userFlags;
public int UserFlags
{
@ -582,11 +584,11 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
return m_drawDistance;
return m_drawDistance;
}
set
{
m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance);
m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance);
}
}
@ -594,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance);
return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance);
}
}
@ -2120,6 +2122,7 @@ namespace OpenSim.Region.Framework.Scenes
if (haveAnims)
SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
// we should be able to receive updates, etc
// so release them
m_inTransit = false;
@ -2238,6 +2241,9 @@ namespace OpenSim.Region.Framework.Scenes
}
finally
{
haveGroupInformation = false;
gotCrossUpdate = false;
crossingFlags = 0;
m_inTransit = false;
}
// if hide force a check
@ -2247,9 +2253,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_currentParcelHide = newhide;
// }
haveGroupInformation = false;
gotCrossUpdate = false;
crossingFlags = 0;
m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
@ -3006,7 +3009,8 @@ namespace OpenSim.Region.Framework.Scenes
MovingToTarget = false;
// 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
// 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_forceToApply = direc;
/*
lock(m_forceToApplyLock)
{
m_forceToApply = direc;
m_forceToApplyValid = true;
}
*/
Velocity = direc;
Animator.UpdateMovementAnimations();
}
@ -4734,17 +4744,21 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void UpdateMovement()
{
/*
if (IsInTransit)
return;
if (m_forceToApply.HasValue)
lock(m_forceToApplyLock)
{
Vector3 force = m_forceToApply.Value;
if (m_forceToApplyValid)
{
Velocity = m_forceToApply;
Velocity = force;
m_forceToApply = null;
TriggerScenePresenceUpdated();
m_forceToApplyValid = false;
TriggerScenePresenceUpdated();
}
}
*/
}
/// <summary>
@ -4767,6 +4781,9 @@ namespace OpenSim.Region.Framework.Scenes
// Appearance.SetHeight();
Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
// lock(m_forceToApplyLock)
// m_forceToApplyValid = false;
PhysicsScene scene = m_scene.PhysicsScene;
Vector3 pVec = AbsolutePosition;

View File

@ -186,8 +186,8 @@ namespace OpenSim.Region.OptionalModules
{
string response = null;
int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity)
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{
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 _throttleUpdates;
private bool _floatOnWater;
private OMV.Vector3 _rotationalVelocity;
private bool _kinematic;
private float _buoyancy;
@ -291,7 +290,7 @@ public sealed class BSCharacter : BSPhysObject
{
RawVelocity = OMV.Vector3.Zero;
_acceleration = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties directly into the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.ZeroMotion", delegate()
@ -303,7 +302,7 @@ public sealed class BSCharacter : BSPhysObject
public override void ZeroAngularMotion(bool inTaintTime)
{
_rotationalVelocity = OMV.Vector3.Zero;
RawRotationalVelocity = OMV.Vector3.Zero;
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 for being below terrain or on water.
// 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 {
get { return RawTorque; }
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 {
get { return _kinematic; }
set { _kinematic = value; }
@ -716,8 +717,6 @@ public sealed class BSCharacter : BSPhysObject
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 scale of that unit shape to create the avatars full size.
@ -841,7 +840,7 @@ public sealed class BSCharacter : BSPhysObject
RawVelocity = entprop.Velocity;
_acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity;
RawRotationalVelocity = entprop.RotationalVelocity;
// Do some sanity checking for the avatar. Make sure it's above ground and inbounds.
if (PositionSanityCheck(true))
@ -861,7 +860,7 @@ public sealed class BSCharacter : BSPhysObject
// PhysScene.PostUpdate(this);
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 abstract OMV.Vector3 ForceVelocity { get; set; }
public OMV.Vector3 RawRotationalVelocity { get; set; }
// RawForce is a constant force applied to object (see Force { set; } )
public OMV.Vector3 RawForce { 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 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; }
@ -582,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor
{
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
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 _throttleUpdates;
private bool _floatOnWater;
private OMV.Vector3 _rotationalVelocity;
private bool _kinematic;
private float _buoyancy;
@ -90,7 +89,7 @@ public class BSPrim : BSPhysObject
RawOrientation = rotation;
_buoyancy = 0f;
RawVelocity = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
RawRotationalVelocity = OMV.Vector3.Zero;
BaseShape = pbs;
_isPhysical = pisPhysical;
_isVolumeDetect = false;
@ -256,7 +255,7 @@ public class BSPrim : BSPhysObject
{
RawVelocity = OMV.Vector3.Zero;
_acceleration = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
@ -267,15 +266,15 @@ public class BSPrim : BSPhysObject
}
public override void ZeroAngularMotion(bool inTaintTime)
{
_rotationalVelocity = OMV.Vector3.Zero;
RawRotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ZeroMotion", delegate()
{
// DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
if (PhysBody.HasPhysicalBody)
{
PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, RawRotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, RawRotationalVelocity);
}
});
}
@ -426,9 +425,9 @@ public class BSPrim : BSPhysObject
RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity);
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;
}
@ -1008,7 +1007,7 @@ public class BSPrim : BSPhysObject
// For good measure, make sure the transform is set through to the motion state
ForcePosition = RawPosition;
ForceVelocity = RawVelocity;
ForceRotationalVelocity = _rotationalVelocity;
ForceRotationalVelocity = RawRotationalVelocity;
// A dynamic object has mass
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 {
get { return _kinematic; }
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
private float CalculateMass()
@ -1930,7 +1897,7 @@ public class BSPrim : BSPhysObject
if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(RawVelocity, BSParam.UpdateVelocityChangeThreshold))
RawVelocity = entprop.Velocity;
_acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity;
RawRotationalVelocity = entprop.RotationalVelocity;
// DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
@ -1939,7 +1906,7 @@ public class BSPrim : BSPhysObject
{
entprop.Position = RawPosition;
entprop.Velocity = RawVelocity;
entprop.RotationalVelocity = _rotationalVelocity;
entprop.RotationalVelocity = RawRotationalVelocity;
entprop.Acceleration = _acceleration;
}

View File

@ -894,7 +894,7 @@
;; The trade-off may be increased memory usage by the script engine.
; 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
@ -903,8 +903,10 @@
;;
;; 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.
;; Some Windows users have also reported script loading problems when AppDomainLoading = false
; AppDomainLoading = true
;; at this time some mono versions seem to have problems with the true option
;; 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)
;; 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.
;; 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.
;; Default is OpenDynamicsEngine
;; Default is BulletSim
physics = BulletSim
;physics = modified_BulletX
;physics = OpenDynamicsEngine
@ -1690,12 +1690,13 @@
; Stack size per thread created
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
; current AppDomain, which will reduce the per-script overhead at the
; expense of reduced security and the inability to garbage collect the
; script assemblies
AppDomainLoading = true
; current AppDomain, which will reduce the per-script overhead but deleted scripts stay inactive using memory
; this may only be a problem if regions stay alive for a long time with lots of scripts added or edited.
; at this time some mono versions seem to have problems with the true option
; 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
; then startup will be considerably faster since scripts won't need to be recompiled. However, then it becomes your responsibility to delete the