Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

user_profiles
Justin Clark-Casey (justincc) 2013-03-01 21:49:05 +00:00
commit 90a19fb573
4 changed files with 63 additions and 15 deletions

View File

@ -961,13 +961,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// ==================================================================
// Clamp high or low velocities
float newVelocityLengthSq = VehicleVelocity.LengthSquared();
if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocitySq)
if (newVelocityLengthSq > BSParam.VehicleMaxLinearVelocitySquared)
{
Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG
VehicleVelocity /= VehicleVelocity.Length();
VehicleVelocity *= BSParam.VehicleMaxLinearVelocity;
VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
Prim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySq, VehicleVelocity);
Prim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity);
}
else if (newVelocityLengthSq < 0.001f)
VehicleVelocity = Vector3.Zero;

View File

@ -47,12 +47,16 @@ public static class BSParam
public static float SculptLOD { get; private set; }
public static int CrossingFailuresBeforeOutOfBounds { get; private set; }
public static float UpdateVelocityChangeThreshold { get; private set; }
public static float MinimumObjectMass { get; private set; }
public static float MaximumObjectMass { get; private set; }
public static float MaxLinearVelocity { get; private set; }
public static float MaxLinearVelocitySquared { get; private set; }
public static float MaxAngularVelocity { get; private set; }
public static float MaxAngularVelocitySquared { get; private set; }
public static float MaxAddForceMagnitude { get; private set; }
public static float MaxAddForceMagnitudeSquared { get; private set; }
public static float DensityScaleFactor { get; private set; }
public static float LinearDamping { get; private set; }
@ -109,7 +113,7 @@ public static class BSParam
// Vehicle parameters
public static float VehicleMaxLinearVelocity { get; private set; }
public static float VehicleMaxLinearVelocitySq { get; private set; }
public static float VehicleMaxLinearVelocitySquared { get; private set; }
public static float VehicleMaxAngularVelocity { get; private set; }
public static float VehicleMaxAngularVelocitySq { get; private set; }
public static float VehicleAngularDamping { get; private set; }
@ -265,7 +269,7 @@ public static class BSParam
// The single letter parameters for the delegates are:
// s = BSScene
// o = BSPhysObject
// v = value (float)
// v = value (appropriate type)
private static ParameterDefnBase[] ParameterDefinitions =
{
new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties",
@ -289,6 +293,10 @@ public static class BSParam
5,
(s) => { return CrossingFailuresBeforeOutOfBounds; },
(s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ),
new ParameterDefn<float>("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator",
0.1f,
(s) => { return UpdateVelocityChangeThreshold; },
(s,v) => { UpdateVelocityChangeThreshold = v; } ),
new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
32f,
@ -343,16 +351,16 @@ public static class BSParam
new ParameterDefn<float>("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object",
1000.0f,
(s) => { return MaxLinearVelocity; },
(s,v) => { MaxLinearVelocity = v; } ),
(s,v) => { MaxLinearVelocity = v; MaxLinearVelocitySquared = v * v; } ),
new ParameterDefn<float>("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object",
1000.0f,
(s) => { return MaxAngularVelocity; },
(s,v) => { MaxAngularVelocity = v; } ),
(s,v) => { MaxAngularVelocity = v; MaxAngularVelocitySquared = v * v; } ),
// LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject
new ParameterDefn<float>("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)",
20000.0f,
(s) => { return MaxAddForceMagnitude; },
(s,v) => { MaxAddForceMagnitude = v; } ),
(s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ),
// Density is passed around as 100kg/m3. This scales that to 1kg/m3.
new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
0.01f,
@ -505,7 +513,7 @@ public static class BSParam
new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
1000.0f,
(s) => { return (float)VehicleMaxLinearVelocity; },
(s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ),
(s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ),
new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle",
12.0f,
(s) => { return (float)VehicleMaxAngularVelocity; },

View File

@ -108,6 +108,9 @@ public class BSPrim : BSPhysObject
// do the actual object creation at taint time
PhysicsScene.TaintedObject("BSPrim.create", delegate()
{
// Make sure the object is being created with some sanity.
ExtremeSanityCheck(true /* inTaintTime */);
CreateGeomAndObject(true);
CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody);
@ -450,6 +453,38 @@ public class BSPrim : BSPhysObject
return ret;
}
// Occasionally things will fly off and really get lost.
// Find the wanderers and bring them back.
// Return 'true' if some parameter need some sanity.
private bool ExtremeSanityCheck(bool inTaintTime)
{
bool ret = false;
uint wayOutThere = Constants.RegionSize * Constants.RegionSize;
// There have been instances of objects getting thrown way out of bounds and crashing
// the border crossing code.
if ( _position.X < -Constants.RegionSize || _position.X > wayOutThere
|| _position.Y < -Constants.RegionSize || _position.Y > wayOutThere
|| _position.Z < -Constants.RegionSize || _position.Z > wayOutThere)
{
_position = new OMV.Vector3(10, 10, 50);
ZeroMotion(inTaintTime);
ret = true;
}
if (_velocity.LengthSquared() > BSParam.MaxLinearVelocity)
{
_velocity = Util.ClampV(_velocity, BSParam.MaxLinearVelocity);
ret = true;
}
if (_rotationalVelocity.LengthSquared() > BSParam.MaxAngularVelocitySquared)
{
_rotationalVelocity = Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity);
ret = true;
}
return ret;
}
// Return the effective mass of the object.
// The definition of this call is to return the mass of the prim.
// If the simulator cares about the mass of the linkset, it will sum it itself.
@ -585,12 +620,12 @@ public class BSPrim : BSPhysObject
if (VehicleController.Type == Vehicle.TYPE_NONE)
{
UnRegisterPreStepAction("BSPrim.Vehicle", LocalID);
PhysicsScene.AfterStep -= VehicleController.PostStep;
UnRegisterPostStepAction("BSPrim.Vehicle", LocalID);
}
else
{
RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step);
PhysicsScene.AfterStep += VehicleController.PostStep;
RegisterPostStepAction("BSPrim.Vehicle", LocalID, VehicleController.PostStep);
}
});
}
@ -732,7 +767,7 @@ public class BSPrim : BSPhysObject
set {
PhysicsScene.AssertInTaintTime("BSPrim.ForceVelocity");
_velocity = value;
_velocity = Util.ClampV(value, BSParam.MaxLinearVelocity);
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.ForceVelocity,taint,vel={1}", LocalID, _velocity);
@ -1098,7 +1133,7 @@ public class BSPrim : BSPhysObject
return _rotationalVelocity;
}
set {
_rotationalVelocity = value;
_rotationalVelocity = Util.ClampV(value, BSParam.MaxAngularVelocity);
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
@ -1230,6 +1265,7 @@ public class BSPrim : BSPhysObject
RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep)
{
// Don't do hovering while the object is selected.
if (!IsPhysicallyActive)
return;
@ -1737,10 +1773,9 @@ public class BSPrim : BSPhysObject
// Assign directly to the local variables so the normal set actions do not happen
_position = entprop.Position;
_orientation = entprop.Rotation;
// _velocity = entprop.Velocity;
// DEBUG DEBUG DEBUG -- smooth velocity changes a bit. The simulator seems to be
// very sensitive to velocity changes.
if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(_velocity, 0.1f))
if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(_velocity, BSParam.UpdateVelocityChangeThreshold))
_velocity = entprop.Velocity;
_acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity;

View File

@ -9,6 +9,9 @@ Enable vehicle border crossings (at least as poorly as ODE)
Lock axis
Deleting a linkset while standing on the root will leave the physical shape of the root behind.
Not sure if it is because standing on it. Done with large prim linksets.
Linkset child rotations.
Nebadon spiral tube has middle sections which are rotated wrong.
Select linked spiral tube. Delink and note where the middle section ends up.
Vehicle angular vertical attraction
vehicle angular banking
Center-of-gravity
@ -68,6 +71,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation
GENERAL TODO LIST:
=================================================
Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects.
Regular triangle meshes don't do physical collisions.
Resitution of a prim works on another prim but not on terrain.
The dropped prim doesn't bounce properly on the terrain.
Add a sanity check for PIDTarget location.