BulletSim: Add banking and other new code to vechile dynamics. Add third party license and contributor in for for Aurora-Sim project for physics code.
parent
783443705d
commit
804b332d45
|
@ -182,12 +182,14 @@ what it is today.
|
||||||
|
|
||||||
This software uses components from the following developers:
|
This software uses components from the following developers:
|
||||||
* Sleepycat Software (Berkeley DB)
|
* Sleepycat Software (Berkeley DB)
|
||||||
|
* Aurora-Sim (http://aurora-sim.org)
|
||||||
* SQLite (Public Domain)
|
* SQLite (Public Domain)
|
||||||
* XmlRpcCS (http://xmlrpccs.sf.net/)
|
* XmlRpcCS (http://xmlrpccs.sf.net/)
|
||||||
* MySQL, Inc. (MySQL Connector/NET)
|
* MySQL, Inc. (MySQL Connector/NET)
|
||||||
* NUnit (http://www.nunit.org)
|
* NUnit (http://www.nunit.org)
|
||||||
* AGEIA Inc. (PhysX)
|
* AGEIA Inc. (PhysX)
|
||||||
* Russel L. Smith (ODE)
|
* Russel L. Smith (ODE)
|
||||||
|
* Erwin Coumans (Bullet)
|
||||||
* Prebuild (http://sourceforge.net/projects/dnpb/)
|
* Prebuild (http://sourceforge.net/projects/dnpb/)
|
||||||
* LibOpenMetaverse (http://lib.openmetaverse.org/)
|
* LibOpenMetaverse (http://lib.openmetaverse.org/)
|
||||||
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
|
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
|
||||||
|
|
|
@ -32,7 +32,7 @@ using OpenMetaverse;
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
public class BS6DofConstraint : BSConstraint
|
public sealed class BS6DofConstraint : BSConstraint
|
||||||
{
|
{
|
||||||
private static string LogHeader = "[BULLETSIM 6DOF CONSTRAINT]";
|
private static string LogHeader = "[BULLETSIM 6DOF CONSTRAINT]";
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSCharacter : BSPhysObject
|
public sealed class BSCharacter : BSPhysObject
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static readonly string LogHeader = "[BULLETS CHAR]";
|
private static readonly string LogHeader = "[BULLETS CHAR]";
|
||||||
|
|
|
@ -33,7 +33,7 @@ using OpenMetaverse;
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
public class BSConstraintCollection : IDisposable
|
public sealed class BSConstraintCollection : IDisposable
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
// private static readonly string LogHeader = "[CONSTRAINT COLLECTION]";
|
// private static readonly string LogHeader = "[CONSTRAINT COLLECTION]";
|
||||||
|
|
|
@ -52,7 +52,7 @@ using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSDynamics
|
public sealed class BSDynamics
|
||||||
{
|
{
|
||||||
private BSScene PhysicsScene { get; set; }
|
private BSScene PhysicsScene { get; set; }
|
||||||
// the prim this dynamic controller belongs to
|
// the prim this dynamic controller belongs to
|
||||||
|
@ -72,8 +72,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// LIMIT_ROLL_ONLY
|
// LIMIT_ROLL_ONLY
|
||||||
private Vector3 m_BlockingEndPoint = Vector3.Zero;
|
private Vector3 m_BlockingEndPoint = Vector3.Zero;
|
||||||
private Quaternion m_RollreferenceFrame = Quaternion.Identity;
|
private Quaternion m_RollreferenceFrame = Quaternion.Identity;
|
||||||
|
private Quaternion m_referenceFrame = Quaternion.Identity;
|
||||||
|
|
||||||
// Linear properties
|
// Linear properties
|
||||||
private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
|
private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
|
||||||
|
private Vector3 m_linearMotorOffset = Vector3.Zero; // the point of force can be offset from the center
|
||||||
private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
|
private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
|
||||||
private Vector3 m_newVelocity = Vector3.Zero; // velocity computed to be applied to body
|
private Vector3 m_newVelocity = Vector3.Zero; // velocity computed to be applied to body
|
||||||
private Vector3 m_linearFrictionTimescale = Vector3.Zero;
|
private Vector3 m_linearFrictionTimescale = Vector3.Zero;
|
||||||
|
@ -95,19 +98,19 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
|
private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
|
||||||
|
|
||||||
//Deflection properties
|
//Deflection properties
|
||||||
// private float m_angularDeflectionEfficiency = 0;
|
private float m_angularDeflectionEfficiency = 0;
|
||||||
// private float m_angularDeflectionTimescale = 0;
|
private float m_angularDeflectionTimescale = 0;
|
||||||
// private float m_linearDeflectionEfficiency = 0;
|
private float m_linearDeflectionEfficiency = 0;
|
||||||
// private float m_linearDeflectionTimescale = 0;
|
private float m_linearDeflectionTimescale = 0;
|
||||||
|
|
||||||
//Banking properties
|
//Banking properties
|
||||||
// private float m_bankingEfficiency = 0;
|
private float m_bankingEfficiency = 0;
|
||||||
// private float m_bankingMix = 0;
|
private float m_bankingMix = 0;
|
||||||
// private float m_bankingTimescale = 0;
|
private float m_bankingTimescale = 0;
|
||||||
|
|
||||||
//Hover and Buoyancy properties
|
//Hover and Buoyancy properties
|
||||||
private float m_VhoverHeight = 0f;
|
private float m_VhoverHeight = 0f;
|
||||||
// private float m_VhoverEfficiency = 0f;
|
private float m_VhoverEfficiency = 0f;
|
||||||
private float m_VhoverTimescale = 0f;
|
private float m_VhoverTimescale = 0f;
|
||||||
private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
|
private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
|
||||||
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
|
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
|
||||||
|
@ -138,10 +141,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
switch (pParam)
|
switch (pParam)
|
||||||
{
|
{
|
||||||
case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
|
case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
|
||||||
// m_angularDeflectionEfficiency = Math.Max(pValue, 0.01f);
|
m_angularDeflectionEfficiency = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
|
case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
|
||||||
// m_angularDeflectionTimescale = Math.Max(pValue, 0.01f);
|
m_angularDeflectionTimescale = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
|
case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
|
||||||
m_angularMotorDecayTimescale = Math.Max(pValue, 0.01f);
|
m_angularMotorDecayTimescale = Math.Max(pValue, 0.01f);
|
||||||
|
@ -150,20 +153,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_angularMotorTimescale = Math.Max(pValue, 0.01f);
|
m_angularMotorTimescale = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_EFFICIENCY:
|
case Vehicle.BANKING_EFFICIENCY:
|
||||||
// m_bankingEfficiency = Math.Max(pValue, 0.01f);
|
m_bankingEfficiency = Math.Max(-1f, Math.Min(pValue, 1f));
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_MIX:
|
case Vehicle.BANKING_MIX:
|
||||||
// m_bankingMix = Math.Max(pValue, 0.01f);
|
m_bankingMix = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_TIMESCALE:
|
case Vehicle.BANKING_TIMESCALE:
|
||||||
// m_bankingTimescale = Math.Max(pValue, 0.01f);
|
m_bankingTimescale = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.BUOYANCY:
|
case Vehicle.BUOYANCY:
|
||||||
m_VehicleBuoyancy = Math.Max(-1f, Math.Min(pValue, 1f));
|
m_VehicleBuoyancy = Math.Max(-1f, Math.Min(pValue, 1f));
|
||||||
break;
|
break;
|
||||||
// case Vehicle.HOVER_EFFICIENCY:
|
case Vehicle.HOVER_EFFICIENCY:
|
||||||
// m_VhoverEfficiency = Math.Max(0f, Math.Min(pValue, 1f));
|
m_VhoverEfficiency = Math.Max(0f, Math.Min(pValue, 1f));
|
||||||
// break;
|
break;
|
||||||
case Vehicle.HOVER_HEIGHT:
|
case Vehicle.HOVER_HEIGHT:
|
||||||
m_VhoverHeight = pValue;
|
m_VhoverHeight = pValue;
|
||||||
break;
|
break;
|
||||||
|
@ -171,10 +174,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_VhoverTimescale = Math.Max(pValue, 0.01f);
|
m_VhoverTimescale = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
|
case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
|
||||||
// m_linearDeflectionEfficiency = Math.Max(pValue, 0.01f);
|
m_linearDeflectionEfficiency = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
|
case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
|
||||||
// m_linearDeflectionTimescale = Math.Max(pValue, 0.01f);
|
m_linearDeflectionTimescale = Math.Max(pValue, 0.01f);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
|
case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
|
||||||
m_linearMotorDecayTimescale = Math.Max(pValue, 0.01f);
|
m_linearMotorDecayTimescale = Math.Max(pValue, 0.01f);
|
||||||
|
@ -196,7 +199,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
||||||
m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
|
m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
|
||||||
m_angularMotorApply = 10;
|
m_angularMotorApply = 100;
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||||
m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
||||||
|
@ -206,7 +209,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_linearMotorDirectionLASTSET = new Vector3(pValue, pValue, pValue);
|
m_linearMotorDirectionLASTSET = new Vector3(pValue, pValue, pValue);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||||
// m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
|
m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,15 +224,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
||||||
m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
|
||||||
// Limit requested angular speed to 2 rps= 4 pi rads/sec
|
// Limit requested angular speed to 2 rps= 4 pi rads/sec
|
||||||
if (m_angularMotorDirection.X > 12.56f) m_angularMotorDirection.X = 12.56f;
|
pValue.X = Math.Max(-12.56f, Math.Min(pValue.X, 12.56f));
|
||||||
if (m_angularMotorDirection.X < - 12.56f) m_angularMotorDirection.X = - 12.56f;
|
pValue.Y = Math.Max(-12.56f, Math.Min(pValue.Y, 12.56f));
|
||||||
if (m_angularMotorDirection.Y > 12.56f) m_angularMotorDirection.Y = 12.56f;
|
pValue.Z = Math.Max(-12.56f, Math.Min(pValue.Z, 12.56f));
|
||||||
if (m_angularMotorDirection.Y < - 12.56f) m_angularMotorDirection.Y = - 12.56f;
|
m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
if (m_angularMotorDirection.Z > 12.56f) m_angularMotorDirection.Z = 12.56f;
|
m_angularMotorApply = 100;
|
||||||
if (m_angularMotorDirection.Z < - 12.56f) m_angularMotorDirection.Z = - 12.56f;
|
|
||||||
m_angularMotorApply = 10;
|
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||||
m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
|
@ -239,7 +239,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_linearMotorDirectionLASTSET = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
m_linearMotorDirectionLASTSET = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||||
// m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
break;
|
break;
|
||||||
case Vehicle.BLOCK_EXIT:
|
case Vehicle.BLOCK_EXIT:
|
||||||
m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
|
@ -253,7 +253,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
switch (pParam)
|
switch (pParam)
|
||||||
{
|
{
|
||||||
case Vehicle.REFERENCE_FRAME:
|
case Vehicle.REFERENCE_FRAME:
|
||||||
// m_referenceFrame = pValue;
|
m_referenceFrame = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.ROLL_FRAME:
|
case Vehicle.ROLL_FRAME:
|
||||||
m_RollreferenceFrame = pValue;
|
m_RollreferenceFrame = pValue;
|
||||||
|
@ -265,21 +265,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", Prim.LocalID, pParam, remove);
|
VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", Prim.LocalID, pParam, remove);
|
||||||
VehicleFlag parm = (VehicleFlag)pParam;
|
VehicleFlag parm = (VehicleFlag)pParam;
|
||||||
if (remove)
|
|
||||||
{
|
|
||||||
if (pParam == -1)
|
if (pParam == -1)
|
||||||
{
|
|
||||||
m_flags = (VehicleFlag)0;
|
m_flags = (VehicleFlag)0;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (remove)
|
||||||
m_flags &= ~parm;
|
m_flags &= ~parm;
|
||||||
}
|
else
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_flags |= parm;
|
m_flags |= parm;
|
||||||
}
|
}
|
||||||
}//end ProcessVehicleFlags
|
}
|
||||||
|
|
||||||
internal void ProcessTypeChange(Vehicle pType)
|
internal void ProcessTypeChange(Vehicle pType)
|
||||||
{
|
{
|
||||||
|
@ -289,98 +284,141 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
switch (pType)
|
switch (pType)
|
||||||
{
|
{
|
||||||
case Vehicle.TYPE_NONE:
|
case Vehicle.TYPE_NONE:
|
||||||
m_linearFrictionTimescale = new Vector3(0, 0, 0);
|
|
||||||
m_angularFrictionTimescale = new Vector3(0, 0, 0);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 0;
|
m_linearMotorTimescale = 0;
|
||||||
m_linearMotorDecayTimescale = 0;
|
m_linearMotorDecayTimescale = 0;
|
||||||
|
m_linearFrictionTimescale = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 0;
|
|
||||||
m_angularMotorDecayTimescale = 0;
|
m_angularMotorDecayTimescale = 0;
|
||||||
|
m_angularMotorTimescale = 0;
|
||||||
|
m_angularFrictionTimescale = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
m_VhoverHeight = 0;
|
m_VhoverHeight = 0;
|
||||||
|
m_VhoverEfficiency = 0;
|
||||||
m_VhoverTimescale = 0;
|
m_VhoverTimescale = 0;
|
||||||
m_VehicleBuoyancy = 0;
|
m_VehicleBuoyancy = 0;
|
||||||
|
|
||||||
|
m_linearDeflectionEfficiency = 1;
|
||||||
|
m_linearDeflectionTimescale = 1;
|
||||||
|
|
||||||
|
m_angularDeflectionEfficiency = 0;
|
||||||
|
m_angularDeflectionTimescale = 1000;
|
||||||
|
|
||||||
|
m_verticalAttractionEfficiency = 0;
|
||||||
|
m_verticalAttractionTimescale = 0;
|
||||||
|
|
||||||
|
m_bankingEfficiency = 0;
|
||||||
|
m_bankingTimescale = 1000;
|
||||||
|
m_bankingMix = 1;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
m_flags = (VehicleFlag)0;
|
m_flags = (VehicleFlag)0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Vehicle.TYPE_SLED:
|
case Vehicle.TYPE_SLED:
|
||||||
m_linearFrictionTimescale = new Vector3(30, 1, 1000);
|
|
||||||
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 1000;
|
m_linearMotorTimescale = 1000;
|
||||||
m_linearMotorDecayTimescale = 120;
|
m_linearMotorDecayTimescale = 120;
|
||||||
|
m_linearFrictionTimescale = new Vector3(30, 1, 1000);
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 1000;
|
m_angularMotorTimescale = 1000;
|
||||||
m_angularMotorDecayTimescale = 120;
|
m_angularMotorDecayTimescale = 120;
|
||||||
|
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
|
|
||||||
m_VhoverHeight = 0;
|
m_VhoverHeight = 0;
|
||||||
// m_VhoverEfficiency = 1;
|
m_VhoverEfficiency = 10; // TODO: this looks wrong!!
|
||||||
m_VhoverTimescale = 10;
|
m_VhoverTimescale = 10;
|
||||||
m_VehicleBuoyancy = 0;
|
m_VehicleBuoyancy = 0;
|
||||||
// m_linearDeflectionEfficiency = 1;
|
|
||||||
// m_linearDeflectionTimescale = 1;
|
m_linearDeflectionEfficiency = 1;
|
||||||
// m_angularDeflectionEfficiency = 1;
|
m_linearDeflectionTimescale = 1;
|
||||||
// m_angularDeflectionTimescale = 1000;
|
|
||||||
// m_bankingEfficiency = 0;
|
m_angularDeflectionEfficiency = 1;
|
||||||
// m_bankingMix = 1;
|
m_angularDeflectionTimescale = 1000;
|
||||||
// m_bankingTimescale = 10;
|
|
||||||
// m_referenceFrame = Quaternion.Identity;
|
m_verticalAttractionEfficiency = 0;
|
||||||
|
m_verticalAttractionTimescale = 0;
|
||||||
|
|
||||||
|
m_bankingEfficiency = 0;
|
||||||
|
m_bankingTimescale = 10;
|
||||||
|
m_bankingMix = 1;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
|
m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
|
||||||
m_flags &=
|
m_flags &=
|
||||||
~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
|
~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
|
||||||
VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
|
VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_CAR:
|
case Vehicle.TYPE_CAR:
|
||||||
m_linearFrictionTimescale = new Vector3(100, 2, 1000);
|
|
||||||
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 1;
|
m_linearMotorTimescale = 1;
|
||||||
m_linearMotorDecayTimescale = 60;
|
m_linearMotorDecayTimescale = 60;
|
||||||
|
m_linearFrictionTimescale = new Vector3(100, 2, 1000);
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 1;
|
m_angularMotorTimescale = 1;
|
||||||
m_angularMotorDecayTimescale = 0.8f;
|
m_angularMotorDecayTimescale = 0.8f;
|
||||||
|
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
|
|
||||||
m_VhoverHeight = 0;
|
m_VhoverHeight = 0;
|
||||||
// m_VhoverEfficiency = 0;
|
m_VhoverEfficiency = 0;
|
||||||
m_VhoverTimescale = 1000;
|
m_VhoverTimescale = 1000;
|
||||||
m_VehicleBuoyancy = 0;
|
m_VehicleBuoyancy = 0;
|
||||||
// // m_linearDeflectionEfficiency = 1;
|
|
||||||
// // m_linearDeflectionTimescale = 2;
|
m_linearDeflectionEfficiency = 1;
|
||||||
// // m_angularDeflectionEfficiency = 0;
|
m_linearDeflectionTimescale = 2;
|
||||||
// m_angularDeflectionTimescale = 10;
|
|
||||||
|
m_angularDeflectionEfficiency = 0;
|
||||||
|
m_angularDeflectionTimescale = 10;
|
||||||
|
|
||||||
m_verticalAttractionEfficiency = 1f;
|
m_verticalAttractionEfficiency = 1f;
|
||||||
m_verticalAttractionTimescale = 10f;
|
m_verticalAttractionTimescale = 10f;
|
||||||
// m_bankingEfficiency = -0.2f;
|
|
||||||
// m_bankingMix = 1;
|
m_bankingEfficiency = -0.2f;
|
||||||
// m_bankingTimescale = 1;
|
m_bankingMix = 1;
|
||||||
// m_referenceFrame = Quaternion.Identity;
|
m_bankingTimescale = 1;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
|
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY
|
||||||
|
| VehicleFlag.HOVER_TERRAIN_ONLY
|
||||||
|
| VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
||||||
m_flags |= (VehicleFlag.NO_DEFLECTION_UP
|
m_flags |= (VehicleFlag.NO_DEFLECTION_UP
|
||||||
| VehicleFlag.LIMIT_ROLL_ONLY
|
| VehicleFlag.LIMIT_ROLL_ONLY
|
||||||
| VehicleFlag.LIMIT_MOTOR_UP);
|
| VehicleFlag.LIMIT_MOTOR_UP
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
| VehicleFlag.HOVER_UP_ONLY);
|
||||||
m_flags |= (VehicleFlag.HOVER_UP_ONLY);
|
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_BOAT:
|
case Vehicle.TYPE_BOAT:
|
||||||
m_linearFrictionTimescale = new Vector3(10, 3, 2);
|
|
||||||
m_angularFrictionTimescale = new Vector3(10,10,10);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 5;
|
m_linearMotorTimescale = 5;
|
||||||
m_linearMotorDecayTimescale = 60;
|
m_linearMotorDecayTimescale = 60;
|
||||||
|
m_linearFrictionTimescale = new Vector3(10, 3, 2);
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 4;
|
m_angularMotorTimescale = 4;
|
||||||
m_angularMotorDecayTimescale = 4;
|
m_angularMotorDecayTimescale = 4;
|
||||||
|
m_angularFrictionTimescale = new Vector3(10,10,10);
|
||||||
|
|
||||||
m_VhoverHeight = 0;
|
m_VhoverHeight = 0;
|
||||||
// m_VhoverEfficiency = 0.5f;
|
m_VhoverEfficiency = 0.5f;
|
||||||
m_VhoverTimescale = 2;
|
m_VhoverTimescale = 2;
|
||||||
m_VehicleBuoyancy = 1;
|
m_VehicleBuoyancy = 1;
|
||||||
// m_linearDeflectionEfficiency = 0.5f;
|
|
||||||
// m_linearDeflectionTimescale = 3;
|
m_linearDeflectionEfficiency = 0.5f;
|
||||||
// m_angularDeflectionEfficiency = 0.5f;
|
m_linearDeflectionTimescale = 3;
|
||||||
// m_angularDeflectionTimescale = 5;
|
|
||||||
|
m_angularDeflectionEfficiency = 0.5f;
|
||||||
|
m_angularDeflectionTimescale = 5;
|
||||||
|
|
||||||
m_verticalAttractionEfficiency = 0.5f;
|
m_verticalAttractionEfficiency = 0.5f;
|
||||||
m_verticalAttractionTimescale = 5f;
|
m_verticalAttractionTimescale = 5f;
|
||||||
// m_bankingEfficiency = -0.3f;
|
|
||||||
// m_bankingMix = 0.8f;
|
m_bankingEfficiency = -0.3f;
|
||||||
// m_bankingTimescale = 1;
|
m_bankingMix = 0.8f;
|
||||||
// m_referenceFrame = Quaternion.Identity;
|
m_bankingTimescale = 1;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY
|
m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY
|
||||||
| VehicleFlag.HOVER_GLOBAL_HEIGHT
|
| VehicleFlag.HOVER_GLOBAL_HEIGHT
|
||||||
| VehicleFlag.LIMIT_ROLL_ONLY
|
| VehicleFlag.LIMIT_ROLL_ONLY
|
||||||
|
@ -390,28 +428,35 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
| VehicleFlag.HOVER_WATER_ONLY);
|
| VehicleFlag.HOVER_WATER_ONLY);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_AIRPLANE:
|
case Vehicle.TYPE_AIRPLANE:
|
||||||
m_linearFrictionTimescale = new Vector3(200, 10, 5);
|
|
||||||
m_angularFrictionTimescale = new Vector3(20, 20, 20);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 2;
|
m_linearMotorTimescale = 2;
|
||||||
m_linearMotorDecayTimescale = 60;
|
m_linearMotorDecayTimescale = 60;
|
||||||
|
m_linearFrictionTimescale = new Vector3(200, 10, 5);
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 4;
|
m_angularMotorTimescale = 4;
|
||||||
m_angularMotorDecayTimescale = 4;
|
m_angularMotorDecayTimescale = 4;
|
||||||
|
m_angularFrictionTimescale = new Vector3(20, 20, 20);
|
||||||
|
|
||||||
m_VhoverHeight = 0;
|
m_VhoverHeight = 0;
|
||||||
// m_VhoverEfficiency = 0.5f;
|
m_VhoverEfficiency = 0.5f;
|
||||||
m_VhoverTimescale = 1000;
|
m_VhoverTimescale = 1000;
|
||||||
m_VehicleBuoyancy = 0;
|
m_VehicleBuoyancy = 0;
|
||||||
// m_linearDeflectionEfficiency = 0.5f;
|
|
||||||
// m_linearDeflectionTimescale = 3;
|
m_linearDeflectionEfficiency = 0.5f;
|
||||||
// m_angularDeflectionEfficiency = 1;
|
m_linearDeflectionTimescale = 3;
|
||||||
// m_angularDeflectionTimescale = 2;
|
|
||||||
|
m_angularDeflectionEfficiency = 1;
|
||||||
|
m_angularDeflectionTimescale = 2;
|
||||||
|
|
||||||
m_verticalAttractionEfficiency = 0.9f;
|
m_verticalAttractionEfficiency = 0.9f;
|
||||||
m_verticalAttractionTimescale = 2f;
|
m_verticalAttractionTimescale = 2f;
|
||||||
// m_bankingEfficiency = 1;
|
|
||||||
// m_bankingMix = 0.7f;
|
m_bankingEfficiency = 1;
|
||||||
// m_bankingTimescale = 2;
|
m_bankingMix = 0.7f;
|
||||||
// m_referenceFrame = Quaternion.Identity;
|
m_bankingTimescale = 2;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY
|
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY
|
||||||
| VehicleFlag.HOVER_TERRAIN_ONLY
|
| VehicleFlag.HOVER_TERRAIN_ONLY
|
||||||
| VehicleFlag.HOVER_GLOBAL_HEIGHT
|
| VehicleFlag.HOVER_GLOBAL_HEIGHT
|
||||||
|
@ -421,28 +466,36 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
|
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_BALLOON:
|
case Vehicle.TYPE_BALLOON:
|
||||||
m_linearFrictionTimescale = new Vector3(5, 5, 5);
|
|
||||||
m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_linearMotorTimescale = 5;
|
m_linearMotorTimescale = 5;
|
||||||
|
m_linearFrictionTimescale = new Vector3(5, 5, 5);
|
||||||
m_linearMotorDecayTimescale = 60;
|
m_linearMotorDecayTimescale = 60;
|
||||||
|
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
m_angularMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorTimescale = 6;
|
m_angularMotorTimescale = 6;
|
||||||
|
m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
||||||
m_angularMotorDecayTimescale = 10;
|
m_angularMotorDecayTimescale = 10;
|
||||||
|
|
||||||
m_VhoverHeight = 5;
|
m_VhoverHeight = 5;
|
||||||
// m_VhoverEfficiency = 0.8f;
|
m_VhoverEfficiency = 0.8f;
|
||||||
m_VhoverTimescale = 10;
|
m_VhoverTimescale = 10;
|
||||||
m_VehicleBuoyancy = 1;
|
m_VehicleBuoyancy = 1;
|
||||||
// m_linearDeflectionEfficiency = 0;
|
|
||||||
// m_linearDeflectionTimescale = 5;
|
m_linearDeflectionEfficiency = 0;
|
||||||
// m_angularDeflectionEfficiency = 0;
|
m_linearDeflectionTimescale = 5;
|
||||||
// m_angularDeflectionTimescale = 5;
|
|
||||||
|
m_angularDeflectionEfficiency = 0;
|
||||||
|
m_angularDeflectionTimescale = 5;
|
||||||
|
|
||||||
m_verticalAttractionEfficiency = 1f;
|
m_verticalAttractionEfficiency = 1f;
|
||||||
m_verticalAttractionTimescale = 100f;
|
m_verticalAttractionTimescale = 100f;
|
||||||
// m_bankingEfficiency = 0;
|
|
||||||
// m_bankingMix = 0.7f;
|
m_bankingEfficiency = 0;
|
||||||
// m_bankingTimescale = 5;
|
m_bankingMix = 0.7f;
|
||||||
// m_referenceFrame = Quaternion.Identity;
|
m_bankingTimescale = 5;
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
|
|
||||||
|
m_referenceFrame = Quaternion.Identity;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY
|
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY
|
||||||
| VehicleFlag.HOVER_TERRAIN_ONLY
|
| VehicleFlag.HOVER_TERRAIN_ONLY
|
||||||
| VehicleFlag.HOVER_UP_ONLY
|
| VehicleFlag.HOVER_UP_ONLY
|
||||||
|
@ -452,21 +505,27 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
| VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
| VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}//end SetDefaultsForType
|
}
|
||||||
|
|
||||||
// Some of the properties of this prim may have changed.
|
// Some of the properties of this prim may have changed.
|
||||||
// Do any updating needed for a vehicle
|
// Do any updating needed for a vehicle
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
if (!IsActive)
|
/*
|
||||||
return;
|
* Doesnt work unless BSDynamics senses and corrects for all collisions
|
||||||
|
if (IsActive)
|
||||||
// Set the prim's inertia to zero. The vehicle code handles that and this
|
BulletSimAPI.AddToCollisionFlags2(Prim.BSBody.ptr, CollisionFlags.CF_KINEMATIC_OBJECT);
|
||||||
// removes the motion and torque actions introduced by Bullet.
|
else
|
||||||
Vector3 inertia = Vector3.Zero;
|
BulletSimAPI.RemoveFromCollisionFlags2(Prim.BSBody.ptr, CollisionFlags.CF_KINEMATIC_OBJECT);
|
||||||
// comment out for DEBUG test
|
*/
|
||||||
// BulletSimAPI.SetMassProps2(Prim.BSBody.ptr, Prim.MassRaw, inertia);
|
/*
|
||||||
// BulletSimAPI.UpdateInertiaTensor2(Prim.BSBody.ptr);
|
* Doesn't work because with zero inertia, Bullet will not apply any forces to the object.
|
||||||
|
if (IsActive)
|
||||||
|
{
|
||||||
|
BulletSimAPI.SetMassProps2(Prim.BSBody.ptr, Prim.MassRaw, Vector3.Zero);
|
||||||
|
BulletSimAPI.UpdateInertiaTensor2(Prim.BSBody.ptr);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// One step of the vehicle properties for the next 'pTimestep' seconds.
|
// One step of the vehicle properties for the next 'pTimestep' seconds.
|
||||||
|
@ -478,6 +537,22 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
MoveAngular(pTimestep);
|
MoveAngular(pTimestep);
|
||||||
LimitRotation(pTimestep);
|
LimitRotation(pTimestep);
|
||||||
|
|
||||||
|
/* Experimental
|
||||||
|
// Wonder if Bullet could handle collision penetration while this applies the forces.
|
||||||
|
// Apply the computed forces on the vehicle
|
||||||
|
Prim.ForcePosition += Prim.ForceVelocity * Prim.MassRaw * pTimestep;
|
||||||
|
|
||||||
|
if (Prim.ForceRotationalVelocity != Vector3.Zero)
|
||||||
|
{
|
||||||
|
Quaternion newOrientation = Prim.ForceOrientation;
|
||||||
|
newOrientation.Normalize();
|
||||||
|
Quaternion appliedRotation = new Quaternion((Prim.ForceRotationalVelocity * pTimestep), 0f);
|
||||||
|
newOrientation += (appliedRotation * newOrientation) * 0.5f;
|
||||||
|
newOrientation.Normalize();
|
||||||
|
Prim.ForceOrientation = newOrientation;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// remember the position so next step we can limit absolute movement effects
|
// remember the position so next step we can limit absolute movement effects
|
||||||
m_lastPositionVector = Prim.ForcePosition;
|
m_lastPositionVector = Prim.ForcePosition;
|
||||||
|
|
||||||
|
@ -489,59 +564,46 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// Also does hover and float.
|
// Also does hover and float.
|
||||||
private void MoveLinear(float pTimestep)
|
private void MoveLinear(float pTimestep)
|
||||||
{
|
{
|
||||||
// m_linearMotorDirection is the direction we are moving relative to the vehicle coordinates
|
// m_linearMotorDirection is the target direction we are moving relative to the vehicle coordinates
|
||||||
// m_lastLinearVelocityVector is the speed we are moving in that direction
|
// m_lastLinearVelocityVector is the current speed we are moving in that direction
|
||||||
if (m_linearMotorDirection.LengthSquared() > 0.001f)
|
if (m_linearMotorDirection.LengthSquared() > 0.001f)
|
||||||
{
|
{
|
||||||
Vector3 origDir = m_linearMotorDirection;
|
Vector3 origDir = m_linearMotorDirection;
|
||||||
Vector3 origVel = m_lastLinearVelocityVector;
|
Vector3 origVel = m_lastLinearVelocityVector;
|
||||||
|
|
||||||
// add drive to body
|
// add drive to body
|
||||||
// Vector3 addAmount = m_linearMotorDirection/(m_linearMotorTimescale / pTimestep);
|
|
||||||
Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale / pTimestep);
|
Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale / pTimestep);
|
||||||
// lastLinearVelocityVector is the current body velocity vector
|
// lastLinearVelocityVector is the current body velocity vector
|
||||||
// RA: Not sure what the *10 is for. A correction for pTimestep?
|
|
||||||
// m_lastLinearVelocityVector += (addAmount*10);
|
|
||||||
m_lastLinearVelocityVector += addAmount;
|
m_lastLinearVelocityVector += addAmount;
|
||||||
|
|
||||||
// Limit the velocity vector to less than the last set linear motor direction
|
|
||||||
if (Math.Abs(m_lastLinearVelocityVector.X) > Math.Abs(m_linearMotorDirectionLASTSET.X))
|
|
||||||
m_lastLinearVelocityVector.X = m_linearMotorDirectionLASTSET.X;
|
|
||||||
if (Math.Abs(m_lastLinearVelocityVector.Y) > Math.Abs(m_linearMotorDirectionLASTSET.Y))
|
|
||||||
m_lastLinearVelocityVector.Y = m_linearMotorDirectionLASTSET.Y;
|
|
||||||
if (Math.Abs(m_lastLinearVelocityVector.Z) > Math.Abs(m_linearMotorDirectionLASTSET.Z))
|
|
||||||
m_lastLinearVelocityVector.Z = m_linearMotorDirectionLASTSET.Z;
|
|
||||||
|
|
||||||
/*
|
|
||||||
// decay applied velocity
|
|
||||||
Vector3 decayfraction = Vector3.One/(m_linearMotorDecayTimescale / pTimestep);
|
|
||||||
// (RA: do not know where the 0.5f comes from)
|
|
||||||
m_linearMotorDirection -= m_linearMotorDirection * decayfraction * 0.5f;
|
|
||||||
*/
|
|
||||||
float keepfraction = 1.0f - (1.0f / (m_linearMotorDecayTimescale / pTimestep));
|
float keepfraction = 1.0f - (1.0f / (m_linearMotorDecayTimescale / pTimestep));
|
||||||
m_linearMotorDirection *= keepfraction;
|
m_linearMotorDirection *= keepfraction;
|
||||||
|
|
||||||
VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},notDecay={4},dir={5},vel={6}",
|
VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},notDecay={4},dir={5},vel={6}",
|
||||||
Prim.LocalID, origDir, origVel, addAmount, keepfraction, m_linearMotorDirection, m_lastLinearVelocityVector);
|
Prim.LocalID, origDir, origVel, addAmount, keepfraction, m_linearMotorDirection, m_lastLinearVelocityVector);
|
||||||
|
|
||||||
|
// convert requested object velocity to object relative vector
|
||||||
|
m_newVelocity = m_lastLinearVelocityVector * Prim.ForceOrientation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if what remains of direction is very small, zero it.
|
// if what remains of direction is very small, zero it.
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
m_linearMotorDirection = Vector3.Zero;
|
||||||
m_lastLinearVelocityVector = Vector3.Zero;
|
m_lastLinearVelocityVector = Vector3.Zero;
|
||||||
|
m_newVelocity = Vector3.Zero;
|
||||||
|
|
||||||
VDetailLog("{0},MoveLinear,zeroed", Prim.LocalID);
|
VDetailLog("{0},MoveLinear,zeroed", Prim.LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert requested object velocity to object relative vector
|
// m_newVelocity is velocity computed from linear motor
|
||||||
Quaternion rotq = Prim.ForceOrientation;
|
|
||||||
m_newVelocity = m_lastLinearVelocityVector * rotq;
|
|
||||||
|
|
||||||
// Add the various forces into m_dir which will be our new direction vector (velocity)
|
// Add the various forces into m_dir which will be our new direction vector (velocity)
|
||||||
|
|
||||||
// add Gravity and Buoyancy
|
// add Gravity and Buoyancy
|
||||||
// There is some gravity, make a gravity force vector that is applied after object velocity.
|
// There is some gravity, make a gravity force vector that is applied after object velocity.
|
||||||
// m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
|
// m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
|
||||||
Vector3 grav = Prim.PhysicsScene.DefaultGravity * (Prim.Linkset.LinksetMass * (1f - m_VehicleBuoyancy));
|
// Vector3 grav = Prim.PhysicsScene.DefaultGravity * (Prim.Linkset.LinksetMass * (1f - m_VehicleBuoyancy));
|
||||||
|
Vector3 grav = Prim.PhysicsScene.DefaultGravity * (1f - m_VehicleBuoyancy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RA: Not sure why one would do this
|
* RA: Not sure why one would do this
|
||||||
|
@ -567,6 +629,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if hovering
|
// Check if hovering
|
||||||
|
// m_VhoverEfficiency: 0=bouncy, 1=totally damped
|
||||||
|
// m_VhoverTimescale: time to achieve height
|
||||||
if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
|
if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
|
||||||
{
|
{
|
||||||
// We should hover, get the target height
|
// We should hover, get the target height
|
||||||
|
@ -597,13 +661,19 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float herr0 = pos.Z - m_VhoverTargetHeight;
|
float horizontalError = pos.Z - m_VhoverTargetHeight;
|
||||||
|
// RA: where does the 50 come from>
|
||||||
|
float horizontalCorrectionVelocity = ((horizontalError * 50.0f) / (m_VhoverTimescale / pTimestep));
|
||||||
// Replace Vertical speed with correction figure if significant
|
// Replace Vertical speed with correction figure if significant
|
||||||
if (Math.Abs(herr0) > 0.01f)
|
if (Math.Abs(horizontalError) > 0.01f)
|
||||||
{
|
{
|
||||||
m_newVelocity.Z = -((herr0 * pTimestep * 50.0f) / m_VhoverTimescale);
|
m_newVelocity.Z += horizontalCorrectionVelocity;
|
||||||
//KF: m_VhoverEfficiency is not yet implemented
|
//KF: m_VhoverEfficiency is not yet implemented
|
||||||
}
|
}
|
||||||
|
else if (horizontalError < -0.01)
|
||||||
|
{
|
||||||
|
m_newVelocity.Z -= horizontalCorrectionVelocity;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_newVelocity.Z = 0f;
|
m_newVelocity.Z = 0f;
|
||||||
|
@ -678,16 +748,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
if ((m_flags & (VehicleFlag.NO_Z)) != 0)
|
if ((m_flags & (VehicleFlag.NO_Z)) != 0)
|
||||||
m_newVelocity.Z = 0;
|
m_newVelocity.Z = 0;
|
||||||
|
|
||||||
// Apply velocity
|
|
||||||
Prim.ForceVelocity = m_newVelocity;
|
|
||||||
// apply gravity force
|
|
||||||
// Why is this set here? The physics engine already does gravity.
|
|
||||||
Prim.AddForce(grav, false, true);
|
|
||||||
|
|
||||||
// Apply friction
|
// Apply friction
|
||||||
Vector3 keepFraction = Vector3.One - (Vector3.One / (m_linearFrictionTimescale / pTimestep));
|
Vector3 keepFraction = Vector3.One - (Vector3.One / (m_linearFrictionTimescale / pTimestep));
|
||||||
m_lastLinearVelocityVector *= keepFraction;
|
m_lastLinearVelocityVector *= keepFraction;
|
||||||
|
|
||||||
|
// Apply velocity
|
||||||
|
// Prim.ForceVelocity = m_newVelocity;
|
||||||
|
Prim.AddForce(m_newVelocity, false);
|
||||||
|
|
||||||
VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}",
|
VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}",
|
||||||
Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction);
|
Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction);
|
||||||
|
|
||||||
|
@ -719,9 +787,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// ramp up to new value
|
// ramp up to new value
|
||||||
// new velocity += error / ( time to get there / step interval)
|
// new velocity += error / ( time to get there / step interval)
|
||||||
// requested speed - last motor speed
|
// requested speed - last motor speed
|
||||||
m_angularMotorVelocity.X += (m_angularMotorDirection.X - m_angularMotorVelocity.X) / (m_angularMotorTimescale / pTimestep);
|
m_angularMotorVelocity += (m_angularMotorDirection - m_angularMotorVelocity) / (m_angularMotorTimescale / pTimestep);
|
||||||
m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep);
|
|
||||||
m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep);
|
|
||||||
|
|
||||||
VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},origDir={5},vel={6}",
|
VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},origDir={5},vel={6}",
|
||||||
Prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origVel, origDir, m_angularMotorVelocity);
|
Prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origVel, origDir, m_angularMotorVelocity);
|
||||||
|
@ -732,46 +798,50 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
// No motor recently applied, keep the body velocity
|
// No motor recently applied, keep the body velocity
|
||||||
// and decay the velocity
|
// and decay the velocity
|
||||||
m_angularMotorVelocity -= m_angularMotorVelocity / (m_angularMotorDecayTimescale / pTimestep);
|
if (m_angularMotorVelocity.LengthSquared() < 0.0001)
|
||||||
if (m_angularMotorVelocity.LengthSquared() < 0.00001)
|
|
||||||
m_angularMotorVelocity = Vector3.Zero;
|
m_angularMotorVelocity = Vector3.Zero;
|
||||||
|
else
|
||||||
|
m_angularMotorVelocity -= m_angularMotorVelocity / (m_angularMotorDecayTimescale / pTimestep);
|
||||||
} // end motor section
|
} // end motor section
|
||||||
|
|
||||||
// Vertical attractor section
|
#region Vertical attactor
|
||||||
|
|
||||||
Vector3 vertattr = Vector3.Zero;
|
Vector3 vertattr = Vector3.Zero;
|
||||||
Vector3 deflection = Vector3.Zero;
|
Vector3 deflection = Vector3.Zero;
|
||||||
Vector3 banking = Vector3.Zero;
|
Vector3 banking = Vector3.Zero;
|
||||||
|
|
||||||
if (m_verticalAttractionTimescale < 300 && m_lastAngularVelocity != Vector3.Zero)
|
if (m_verticalAttractionTimescale < 300 && m_lastAngularVelocity != Vector3.Zero)
|
||||||
{
|
{
|
||||||
float VAservo = 0.2f / (m_verticalAttractionTimescale / pTimestep);
|
float VAservo = 0.2f;
|
||||||
|
if (Prim.Linkset.LinksetIsColliding)
|
||||||
|
VAservo = 0.05f / (m_verticalAttractionTimescale / pTimestep);
|
||||||
|
|
||||||
VAservo *= (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency);
|
VAservo *= (m_verticalAttractionEfficiency * m_verticalAttractionEfficiency);
|
||||||
|
|
||||||
// get present body rotation
|
// get present body rotation
|
||||||
Quaternion rotq = Prim.ForceOrientation;
|
Quaternion rotq = Prim.ForceOrientation;
|
||||||
// vector pointing up
|
// vector pointing up
|
||||||
Vector3 verterr = Vector3.Zero;
|
Vector3 verticalError = Vector3.UnitZ;
|
||||||
verterr.Z = 1.0f;
|
|
||||||
|
|
||||||
// rotate it to Body Angle
|
// rotate it to Body Angle
|
||||||
verterr = verterr * rotq;
|
verticalError = verticalError * rotq;
|
||||||
// verterr.X and .Y are the World error amounts. They are 0 when there is no error (Vehicle Body is 'vertical'), and .Z will be 1.
|
// verticalError.X and .Y are the World error amounts. They are 0 when there is no error (Vehicle Body is 'vertical'), and .Z will be 1.
|
||||||
// As the body leans to its side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall and .Z will go
|
// As the body leans to its side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall and .Z will go
|
||||||
// negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body.
|
// negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body.
|
||||||
|
|
||||||
// Error is 0 (no error) to +/- 2 (max error)
|
// Error is 0 (no error) to +/- 2 (max error)
|
||||||
if (verterr.Z < 0.0f)
|
if (verticalError.Z < 0.0f)
|
||||||
{
|
{
|
||||||
verterr.X = 2.0f - verterr.X;
|
verticalError.X = 2.0f - verticalError.X;
|
||||||
verterr.Y = 2.0f - verterr.Y;
|
verticalError.Y = 2.0f - verticalError.Y;
|
||||||
}
|
}
|
||||||
// scale it by VAservo
|
// scale it by VAservo
|
||||||
verterr = verterr * VAservo;
|
verticalError = verticalError * VAservo;
|
||||||
|
|
||||||
// As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so
|
// As the body rotates around the X axis, then verticalError.Y increases; Rotated around Y then .X increases, so
|
||||||
// Change Body angular velocity X based on Y, and Y based on X. Z is not changed.
|
// Change Body angular velocity X based on Y, and Y based on X. Z is not changed.
|
||||||
vertattr.X = verterr.Y;
|
vertattr.X = verticalError.Y;
|
||||||
vertattr.Y = - verterr.X;
|
vertattr.Y = - verticalError.X;
|
||||||
vertattr.Z = 0f;
|
vertattr.Z = 0f;
|
||||||
|
|
||||||
// scaling appears better usingsquare-law
|
// scaling appears better usingsquare-law
|
||||||
|
@ -779,10 +849,77 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
vertattr.X += bounce * angularVelocity.X;
|
vertattr.X += bounce * angularVelocity.X;
|
||||||
vertattr.Y += bounce * angularVelocity.Y;
|
vertattr.Y += bounce * angularVelocity.Y;
|
||||||
|
|
||||||
VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}",
|
VDetailLog("{0},MoveAngular,verticalAttraction,verticalError={1},bounce={2},vertattr={3}",
|
||||||
Prim.LocalID, verterr, bounce, vertattr);
|
Prim.LocalID, verticalError, bounce, vertattr);
|
||||||
|
|
||||||
} // else vertical attractor is off
|
}
|
||||||
|
#endregion // Vertical attactor
|
||||||
|
|
||||||
|
#region Deflection
|
||||||
|
|
||||||
|
//Forward is the prefered direction, but if the reference frame has changed, we need to take this into account as well
|
||||||
|
Vector3 PreferredAxisOfMotion =
|
||||||
|
new Vector3((10*(m_angularDeflectionEfficiency/m_angularDeflectionTimescale)), 0, 0);
|
||||||
|
PreferredAxisOfMotion *= Quaternion.Add(Prim.ForceOrientation, m_referenceFrame);
|
||||||
|
|
||||||
|
//Multiply it so that it scales linearly
|
||||||
|
//deflection = PreferredAxisOfMotion;
|
||||||
|
|
||||||
|
//deflection = ((PreferredAxisOfMotion * m_angularDeflectionEfficiency) / (m_angularDeflectionTimescale / pTimestep));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Banking
|
||||||
|
|
||||||
|
if (m_bankingEfficiency != 0)
|
||||||
|
{
|
||||||
|
Vector3 dir = Vector3.One * Prim.ForceOrientation;
|
||||||
|
float mult = (m_bankingMix*m_bankingMix)*-1*(m_bankingMix < 0 ? -1 : 1);
|
||||||
|
//Changes which way it banks in and out of turns
|
||||||
|
|
||||||
|
//Use the square of the efficiency, as it looks much more how SL banking works
|
||||||
|
float effSquared = (m_bankingEfficiency*m_bankingEfficiency);
|
||||||
|
if (m_bankingEfficiency < 0)
|
||||||
|
effSquared *= -1; //Keep the negative!
|
||||||
|
|
||||||
|
float mix = Math.Abs(m_bankingMix);
|
||||||
|
if (m_angularMotorVelocity.X == 0)
|
||||||
|
{
|
||||||
|
/*if (!parent.Orientation.ApproxEquals(this.m_referenceFrame, 0.25f))
|
||||||
|
{
|
||||||
|
Vector3 axisAngle;
|
||||||
|
float angle;
|
||||||
|
parent.Orientation.GetAxisAngle(out axisAngle, out angle);
|
||||||
|
Vector3 rotatedVel = parent.Velocity * parent.Orientation;
|
||||||
|
if ((rotatedVel.X < 0 && axisAngle.Y > 0) || (rotatedVel.X > 0 && axisAngle.Y < 0))
|
||||||
|
m_angularMotorVelocity.X += (effSquared * (mult * mix)) * (1f) * 10;
|
||||||
|
else
|
||||||
|
m_angularMotorVelocity.X += (effSquared * (mult * mix)) * (-1f) * 10;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
banking.Z += (effSquared*(mult*mix))*(m_angularMotorVelocity.X) * 4;
|
||||||
|
if (!Prim.Linkset.LinksetIsColliding && Math.Abs(m_angularMotorVelocity.X) > mix)
|
||||||
|
//If they are colliding, we probably shouldn't shove the prim around... probably
|
||||||
|
{
|
||||||
|
float angVelZ = m_angularMotorVelocity.X*-1;
|
||||||
|
/*if(angVelZ > mix)
|
||||||
|
angVelZ = mix;
|
||||||
|
else if(angVelZ < -mix)
|
||||||
|
angVelZ = -mix;*/
|
||||||
|
//This controls how fast and how far the banking occurs
|
||||||
|
Vector3 bankingRot = new Vector3(angVelZ*(effSquared*mult), 0, 0);
|
||||||
|
if (bankingRot.X > 3)
|
||||||
|
bankingRot.X = 3;
|
||||||
|
else if (bankingRot.X < -3)
|
||||||
|
bankingRot.X = -3;
|
||||||
|
bankingRot *= Prim.ForceOrientation;
|
||||||
|
banking += bankingRot;
|
||||||
|
}
|
||||||
|
m_angularMotorVelocity.X *= m_bankingEfficiency == 1 ? 0.0f : 1 - m_bankingEfficiency;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
m_lastVertAttractor = vertattr;
|
m_lastVertAttractor = vertattr;
|
||||||
|
|
||||||
|
@ -811,7 +948,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_lastAngularVelocity -= m_lastAngularVelocity * decayamount;
|
m_lastAngularVelocity -= m_lastAngularVelocity * decayamount;
|
||||||
|
|
||||||
// Apply to the body
|
// Apply to the body
|
||||||
Prim.ForceRotationalVelocity = m_lastAngularVelocity;
|
// Prim.ForceRotationalVelocity = m_lastAngularVelocity;
|
||||||
|
Prim.AddAngularForce(m_lastAngularVelocity, false);
|
||||||
|
|
||||||
VDetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", Prim.LocalID, decayamount, m_lastAngularVelocity);
|
VDetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", Prim.LocalID, decayamount, m_lastAngularVelocity);
|
||||||
} //end MoveAngular
|
} //end MoveAngular
|
||||||
|
@ -820,38 +958,31 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
Quaternion rotq = Prim.ForceOrientation;
|
Quaternion rotq = Prim.ForceOrientation;
|
||||||
Quaternion m_rot = rotq;
|
Quaternion m_rot = rotq;
|
||||||
bool changed = false;
|
|
||||||
if (m_RollreferenceFrame != Quaternion.Identity)
|
if (m_RollreferenceFrame != Quaternion.Identity)
|
||||||
{
|
{
|
||||||
if (rotq.X >= m_RollreferenceFrame.X)
|
if (rotq.X >= m_RollreferenceFrame.X)
|
||||||
{
|
{
|
||||||
m_rot.X = rotq.X - (m_RollreferenceFrame.X / 2);
|
m_rot.X = rotq.X - (m_RollreferenceFrame.X / 2);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
if (rotq.Y >= m_RollreferenceFrame.Y)
|
if (rotq.Y >= m_RollreferenceFrame.Y)
|
||||||
{
|
{
|
||||||
m_rot.Y = rotq.Y - (m_RollreferenceFrame.Y / 2);
|
m_rot.Y = rotq.Y - (m_RollreferenceFrame.Y / 2);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
if (rotq.X <= -m_RollreferenceFrame.X)
|
if (rotq.X <= -m_RollreferenceFrame.X)
|
||||||
{
|
{
|
||||||
m_rot.X = rotq.X + (m_RollreferenceFrame.X / 2);
|
m_rot.X = rotq.X + (m_RollreferenceFrame.X / 2);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
if (rotq.Y <= -m_RollreferenceFrame.Y)
|
if (rotq.Y <= -m_RollreferenceFrame.Y)
|
||||||
{
|
{
|
||||||
m_rot.Y = rotq.Y + (m_RollreferenceFrame.Y / 2);
|
m_rot.Y = rotq.Y + (m_RollreferenceFrame.Y / 2);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
if ((m_flags & VehicleFlag.LOCK_ROTATION) != 0)
|
if ((m_flags & VehicleFlag.LOCK_ROTATION) != 0)
|
||||||
{
|
{
|
||||||
m_rot.X = 0;
|
m_rot.X = 0;
|
||||||
m_rot.Y = 0;
|
m_rot.Y = 0;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
if (changed)
|
if (rotq != m_rot)
|
||||||
{
|
{
|
||||||
Prim.ForceOrientation = m_rot;
|
Prim.ForceOrientation = m_rot;
|
||||||
VDetailLog("{0},LimitRotation,done,orig={1},new={2}", Prim.LocalID, rotq, m_rot);
|
VDetailLog("{0},LimitRotation,done,orig={1},new={2}", Prim.LocalID, rotq, m_rot);
|
||||||
|
|
|
@ -32,7 +32,7 @@ using OpenMetaverse;
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
class BSHingeConstraint : BSConstraint
|
public sealed class BSHingeConstraint : BSConstraint
|
||||||
{
|
{
|
||||||
public override ConstraintType Type { get { return ConstraintType.HINGE_CONSTRAINT_TYPE; } }
|
public override ConstraintType Type { get { return ConstraintType.HINGE_CONSTRAINT_TYPE; } }
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,8 @@ public abstract class BSLinkset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool LinksetIsColliding { get { return false; } }
|
||||||
|
|
||||||
public OMV.Vector3 CenterOfMass
|
public OMV.Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return ComputeLinksetCenterOfMass(); }
|
get { return ComputeLinksetCenterOfMass(); }
|
||||||
|
|
|
@ -32,7 +32,7 @@ using OMV = OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSLinksetConstraints : BSLinkset
|
public sealed class BSLinksetConstraints : BSLinkset
|
||||||
{
|
{
|
||||||
// private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]";
|
// private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]";
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,7 @@ public sealed class BSPrim : BSPhysObject
|
||||||
if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
|
if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
|
||||||
{
|
{
|
||||||
float waterHeight = PhysicsScene.GetWaterLevelAtXYZ(_position);
|
float waterHeight = PhysicsScene.GetWaterLevelAtXYZ(_position);
|
||||||
|
// TODO: a floating motor so object will bob in the water
|
||||||
if (Position.Z < waterHeight)
|
if (Position.Z < waterHeight)
|
||||||
{
|
{
|
||||||
_position.Z = waterHeight;
|
_position.Z = waterHeight;
|
||||||
|
@ -902,6 +903,7 @@ public sealed class BSPrim : BSPhysObject
|
||||||
}
|
}
|
||||||
// DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, fSum);
|
// DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, fSum);
|
||||||
// For unknown reasons, "ApplyCentralForce" adds this force to the total force on the object.
|
// For unknown reasons, "ApplyCentralForce" adds this force to the total force on the object.
|
||||||
|
if (fSum != OMV.Vector3.Zero)
|
||||||
BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum);
|
BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum);
|
||||||
};
|
};
|
||||||
if (inTaintTime)
|
if (inTaintTime)
|
||||||
|
|
|
@ -62,7 +62,7 @@ using OpenMetaverse;
|
||||||
//
|
//
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSScene : PhysicsScene, IPhysicsParameters
|
public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static readonly string LogHeader = "[BULLETS SCENE]";
|
private static readonly string LogHeader = "[BULLETS SCENE]";
|
||||||
|
|
|
@ -34,7 +34,7 @@ using OpenSim.Region.Physics.ConvexDecompositionDotNet;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSShapeCollection : IDisposable
|
public sealed class BSShapeCollection : IDisposable
|
||||||
{
|
{
|
||||||
private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
|
private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BulletSPlugin
|
namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
public class BSTerrainManager
|
public sealed class BSTerrainManager
|
||||||
{
|
{
|
||||||
static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
|
static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://aurora-sim.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the Aurora-Sim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
Loading…
Reference in New Issue