Merge branch 'master' into careminster
commit
caea7601cb
|
@ -87,7 +87,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
|
||||
private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
|
||||
private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
|
||||
private Vector3 m_lastAngularCorrection = Vector3.Zero;
|
||||
private Vector3 m_lastAngularVelocity = Vector3.Zero;
|
||||
private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
|
||||
|
||||
//Deflection properties
|
||||
|
@ -128,7 +128,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// Return 'true' if this vehicle is doing vehicle things
|
||||
public bool IsActive
|
||||
{
|
||||
get { return Type != Vehicle.TYPE_NONE; }
|
||||
get { return Type != Vehicle.TYPE_NONE && Prim.IsPhysical; }
|
||||
}
|
||||
|
||||
internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
|
||||
|
@ -664,6 +664,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// an UpdateProperties event to send the changes up to the simulator.
|
||||
BulletSimAPI.PushUpdate2(Prim.PhysBody.ptr);
|
||||
}
|
||||
m_knownChanged = 0;
|
||||
}
|
||||
|
||||
// Since the computation of terrain height can be a little involved, this routine
|
||||
|
@ -993,11 +994,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
public Vector3 ComputeLinearMotorUp(float pTimestep)
|
||||
{
|
||||
Vector3 ret = Vector3.Zero;
|
||||
float distanceAboveGround = 0f;
|
||||
|
||||
if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
|
||||
{
|
||||
float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition);
|
||||
float distanceAboveGround = VehiclePosition.Z - targetHeight;
|
||||
distanceAboveGround = VehiclePosition.Z - targetHeight;
|
||||
// Not colliding if the vehicle is off the ground
|
||||
if (!Prim.IsColliding)
|
||||
{
|
||||
|
@ -1010,9 +1012,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// has a decay factor. This says this force should
|
||||
// be computed with a motor.
|
||||
// TODO: add interaction with banking.
|
||||
}
|
||||
VDetailLog("{0}, MoveLinear,limitMotorUp,distAbove={1},colliding={2},ret={3}",
|
||||
Prim.LocalID, distanceAboveGround, Prim.IsColliding, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1049,8 +1051,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// ==================================================================
|
||||
m_lastVertAttractor = verticalAttractionContribution;
|
||||
|
||||
// Sum corrections
|
||||
m_lastAngularCorrection = angularMotorContribution
|
||||
m_lastAngularVelocity = angularMotorContribution
|
||||
+ verticalAttractionContribution
|
||||
+ deflectionContribution
|
||||
+ bankingContribution;
|
||||
|
@ -1058,19 +1059,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// ==================================================================
|
||||
// Apply the correction velocity.
|
||||
// TODO: Should this be applied as an angular force (torque)?
|
||||
if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f))
|
||||
if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
|
||||
{
|
||||
// DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions.
|
||||
Vector3 scaledCorrection = m_lastAngularCorrection;
|
||||
if (PhysicsScene.VehicleScaleAngularVelocityByTimestep)
|
||||
scaledCorrection *= pTimestep;
|
||||
VehicleRotationalVelocity = scaledCorrection;
|
||||
VehicleRotationalVelocity = m_lastAngularVelocity;
|
||||
|
||||
VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}",
|
||||
VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5}",
|
||||
Prim.LocalID,
|
||||
angularMotorContribution, verticalAttractionContribution,
|
||||
bankingContribution, deflectionContribution,
|
||||
m_lastAngularCorrection, scaledCorrection
|
||||
m_lastAngularVelocity
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -1124,17 +1121,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
{
|
||||
Vector3 ret = Vector3.Zero;
|
||||
|
||||
// If vertical attaction timescale is reasonable and we applied an angular force last time...
|
||||
// If vertical attaction timescale is reasonable
|
||||
if (m_verticalAttractionTimescale < m_verticalAttractionCutoff)
|
||||
{
|
||||
// Take a vector pointing up and convert it from world to vehicle relative coords.
|
||||
Vector3 verticalError = Vector3.UnitZ * VehicleOrientation;
|
||||
verticalError.Normalize();
|
||||
|
||||
// If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
|
||||
// is now leaning to one side (rotated around the X axis) and the Y value will
|
||||
// go from zero (nearly straight up) to one (completely to the side) or leaning
|
||||
// front-to-back (rotated around the Y axis) and the value of X will be between
|
||||
// is now:
|
||||
// leaning to one side: rotated around the X axis with the Y value going
|
||||
// from zero (nearly straight up) to one (completely to the side)) or
|
||||
// leaning front-to-back: rotated around the Y axis with the value of X being between
|
||||
// zero and one.
|
||||
// The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees.
|
||||
|
||||
|
|
|
@ -94,10 +94,10 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
}
|
||||
|
||||
// Schedule a refresh to happen after all the other taint processing.
|
||||
private void ScheduleRebuild()
|
||||
private void ScheduleRebuild(BSPhysObject requestor)
|
||||
{
|
||||
DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}",
|
||||
LinksetRoot.LocalID, Rebuilding);
|
||||
requestor.LocalID, Rebuilding);
|
||||
// When rebuilding, it is possible to set properties that would normally require a rebuild.
|
||||
// If already rebuilding, don't request another rebuild.
|
||||
if (!Rebuilding)
|
||||
|
@ -124,7 +124,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
{
|
||||
// The root is going dynamic. Make sure mass is properly set.
|
||||
m_mass = ComputeLinksetMass();
|
||||
ScheduleRebuild();
|
||||
ScheduleRebuild(LinksetRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
|
||||
if (IsRoot(child))
|
||||
{
|
||||
ScheduleRebuild();
|
||||
ScheduleRebuild(LinksetRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
&& PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
|
||||
{
|
||||
updated.LinksetInfo = null;
|
||||
ScheduleRebuild();
|
||||
ScheduleRebuild(updated);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
|
||||
|
||||
// Rebuild the compound shape with the new child shape included
|
||||
ScheduleRebuild();
|
||||
ScheduleRebuild(child);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
else
|
||||
{
|
||||
// Rebuild the compound shape with the child removed
|
||||
ScheduleRebuild();
|
||||
ScheduleRebuild(child);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -134,8 +134,6 @@ public class BSVMotor : BSMotor
|
|||
Vector3 addAmount = (TargetValue - CurrentValue)/TimeScale * timeStep;
|
||||
CurrentValue += addAmount;
|
||||
|
||||
returnCurrent = CurrentValue;
|
||||
|
||||
// The desired value reduces to zero which also reduces the difference with current.
|
||||
// If the decay time is infinite, don't decay at all.
|
||||
float decayFactor = 0f;
|
||||
|
@ -156,6 +154,8 @@ public class BSVMotor : BSMotor
|
|||
CurrentValue *= (Vector3.One - frictionFactor);
|
||||
}
|
||||
|
||||
returnCurrent = CurrentValue;
|
||||
|
||||
MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},timeScale={5},addAmnt={6},targetDecay={7},decayFact={8},fricTS={9},frictFact={10}",
|
||||
BSScene.DetailLogZero, UseName, origCurrVal, origTarget,
|
||||
timeStep, TimeScale, addAmount,
|
||||
|
|
|
@ -189,7 +189,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
// 'true' of the vehicle code is to log lots of details
|
||||
public bool VehicleLoggingEnabled { get; private set; }
|
||||
public bool VehiclePhysicalLoggingEnabled { get; private set; }
|
||||
public bool VehicleScaleAngularVelocityByTimestep { get; private set; }
|
||||
|
||||
#region Construction and Initialization
|
||||
public BSScene(string identifier)
|
||||
|
@ -1239,11 +1238,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
(s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); },
|
||||
(s) => { return s.m_params[0].vehicleAngularDamping; },
|
||||
(s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ),
|
||||
new ParameterDefn("VehicleScaleAngularVelocityByTimestep", "If true, scale angular turning by timestep",
|
||||
ConfigurationParameters.numericFalse,
|
||||
(s,cf,p,v) => { s.VehicleScaleAngularVelocityByTimestep = cf.GetBoolean(p, s.BoolNumeric(v)); },
|
||||
(s) => { return s.NumericBool(s.VehicleScaleAngularVelocityByTimestep); },
|
||||
(s,p,l,v) => { s.VehicleScaleAngularVelocityByTimestep = s.BoolNumeric(v); } ),
|
||||
|
||||
new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
|
||||
0f,
|
||||
|
|
|
@ -5,7 +5,7 @@ Eliminate all crashes (DONEish)
|
|||
Border crossing of physical linkset (DONE)
|
||||
Enable vehicle border crossings (at least as poorly as ODE)
|
||||
Avatar created in previous region and not new region when crossing border
|
||||
Vehicle recreated in new sim at small Z value (offset from root value?)
|
||||
Vehicle recreated in new sim at small Z value (offset from root value?) (DONE)
|
||||
Calibrate turning radius
|
||||
limitMotorUp calibration (more down?)
|
||||
study PID motors (include 'efficiency' implementation
|
||||
|
|
|
@ -147,7 +147,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
/// <summary>
|
||||
/// Stop the script instance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
|
||||
/// there is a danger that it will self-abort and not complete the reset.
|
||||
/// </remarks>
|
||||
/// <param name="timeout"></param>
|
||||
/// How many milliseconds we will wait for an existing script event to finish before
|
||||
/// forcibly aborting that event.
|
||||
/// <returns>true if the script was successfully stopped, false otherwise</returns>
|
||||
bool Stop(int timeout);
|
||||
|
||||
|
@ -169,8 +175,31 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
object EventProcessor();
|
||||
|
||||
int EventTime();
|
||||
void ResetScript();
|
||||
|
||||
/// <summary>
|
||||
/// Reset the script.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
|
||||
/// there is a danger that it will self-abort and not complete the reset. Such a thread must call
|
||||
/// ApiResetScript() instead.
|
||||
/// </remarks>
|
||||
/// <param name='timeout'>
|
||||
/// How many milliseconds we will wait for an existing script event to finish before
|
||||
/// forcibly aborting that event prior to script reset.
|
||||
/// </param>
|
||||
void ResetScript(int timeout);
|
||||
|
||||
/// <summary>
|
||||
/// Reset the script.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This must not be called by any thread other than the one executing the scripts current event. This is
|
||||
/// because there is no wait or abort logic if another thread is in the middle of processing a script event.
|
||||
/// Such an external thread should use ResetScript() instead.
|
||||
/// </remarks>
|
||||
void ApiResetScript();
|
||||
|
||||
Dictionary<string, object> GetVars();
|
||||
void SetVars(Dictionary<string, object> vars);
|
||||
DetectParams GetDetectParams(int idx);
|
||||
|
|
|
@ -880,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
return (DateTime.Now - m_EventStart).Seconds;
|
||||
}
|
||||
|
||||
public void ResetScript()
|
||||
public void ResetScript(int timeout)
|
||||
{
|
||||
if (m_Script == null)
|
||||
return;
|
||||
|
@ -890,7 +890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
RemoveState();
|
||||
ReleaseControls();
|
||||
|
||||
Stop(0);
|
||||
Stop(timeout);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
|
||||
|
|
|
@ -1783,7 +1783,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
if (instance != null)
|
||||
instance.ResetScript();
|
||||
instance.ResetScript(m_WaitForEventCompletionOnScriptStop);
|
||||
}
|
||||
|
||||
public void StartScript(UUID itemID)
|
||||
|
|
Loading…
Reference in New Issue