changed how vehicle data is stored and passed to physics. use unsafe in serializer, tried to control m_dupeInProgress
parent
91a326331f
commit
3aee642190
|
@ -37,9 +37,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
public Vehicle Type
|
public Vehicle Type
|
||||||
{
|
{
|
||||||
get { return m_type; }
|
get { return vd.m_type; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VehicleData vd;
|
||||||
|
/*
|
||||||
private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
|
private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
|
||||||
private VehicleFlag m_flags = (VehicleFlag)0;
|
private VehicleFlag m_flags = (VehicleFlag)0;
|
||||||
|
|
||||||
|
@ -78,7 +80,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor.
|
private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor.
|
||||||
|
|
||||||
// Axis
|
// Axis
|
||||||
public Quaternion m_referenceFrame = Quaternion.Identity;
|
public Quaternion m_referenceFrame = Quaternion.Identity;
|
||||||
|
*/
|
||||||
|
public SOGVehicle()
|
||||||
|
{
|
||||||
|
vd = new VehicleData();
|
||||||
|
ProcessTypeChange(Vehicle.TYPE_NONE); // is needed?
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
|
public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
|
||||||
{
|
{
|
||||||
|
@ -89,109 +97,109 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
|
case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
|
||||||
if (pValue < 0f) pValue = 0f;
|
if (pValue < 0f) pValue = 0f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_angularDeflectionEfficiency = pValue;
|
vd.m_angularDeflectionEfficiency = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
|
case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_angularDeflectionTimescale = pValue;
|
vd.m_angularDeflectionTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
|
case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
else if (pValue > 120) pValue = 120;
|
else if (pValue > 120) pValue = 120;
|
||||||
m_angularMotorDecayTimescale = pValue;
|
vd.m_angularMotorDecayTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_TIMESCALE:
|
case Vehicle.ANGULAR_MOTOR_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_angularMotorTimescale = pValue;
|
vd.m_angularMotorTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_EFFICIENCY:
|
case Vehicle.BANKING_EFFICIENCY:
|
||||||
if (pValue < -1f) pValue = -1f;
|
if (pValue < -1f) pValue = -1f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_bankingEfficiency = pValue;
|
vd.m_bankingEfficiency = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_MIX:
|
case Vehicle.BANKING_MIX:
|
||||||
if (pValue < 0f) pValue = 0f;
|
if (pValue < 0f) pValue = 0f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_bankingMix = pValue;
|
vd.m_bankingMix = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.BANKING_TIMESCALE:
|
case Vehicle.BANKING_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_bankingTimescale = pValue;
|
vd.m_bankingTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.BUOYANCY:
|
case Vehicle.BUOYANCY:
|
||||||
if (pValue < -1f) pValue = -1f;
|
if (pValue < -1f) pValue = -1f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_VehicleBuoyancy = pValue;
|
vd.m_VehicleBuoyancy = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.HOVER_EFFICIENCY:
|
case Vehicle.HOVER_EFFICIENCY:
|
||||||
if (pValue < 0f) pValue = 0f;
|
if (pValue < 0f) pValue = 0f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_VhoverEfficiency = pValue;
|
vd.m_VhoverEfficiency = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.HOVER_HEIGHT:
|
case Vehicle.HOVER_HEIGHT:
|
||||||
m_VhoverHeight = pValue;
|
vd.m_VhoverHeight = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.HOVER_TIMESCALE:
|
case Vehicle.HOVER_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_VhoverTimescale = pValue;
|
vd.m_VhoverTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
|
case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
|
||||||
if (pValue < 0f) pValue = 0f;
|
if (pValue < 0f) pValue = 0f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_linearDeflectionEfficiency = pValue;
|
vd.m_linearDeflectionEfficiency = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
|
case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_linearDeflectionTimescale = pValue;
|
vd.m_linearDeflectionTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
|
case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
|
||||||
// if (pValue < timestep) pValue = timestep;
|
// if (pValue < timestep) pValue = timestep;
|
||||||
// try to make impulses to work a bit better
|
// try to make impulses to work a bit better
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
else if (pValue > 120) pValue = 120;
|
else if (pValue > 120) pValue = 120;
|
||||||
m_linearMotorDecayTimescale = pValue;
|
vd.m_linearMotorDecayTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_TIMESCALE:
|
case Vehicle.LINEAR_MOTOR_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_linearMotorTimescale = pValue;
|
vd.m_linearMotorTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY:
|
case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY:
|
||||||
if (pValue < 0f) pValue = 0f;
|
if (pValue < 0f) pValue = 0f;
|
||||||
if (pValue > 1f) pValue = 1f;
|
if (pValue > 1f) pValue = 1f;
|
||||||
m_verticalAttractionEfficiency = pValue;
|
vd.m_verticalAttractionEfficiency = pValue;
|
||||||
break;
|
break;
|
||||||
case Vehicle.VERTICAL_ATTRACTION_TIMESCALE:
|
case Vehicle.VERTICAL_ATTRACTION_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_verticalAttractionTimescale = pValue;
|
vd.m_verticalAttractionTimescale = pValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// These are vector properties but the engine lets you use a single float value to
|
// These are vector properties but the engine lets you use a single float value to
|
||||||
// set all of the components to the same value
|
// set all of the components to the same value
|
||||||
case Vehicle.ANGULAR_FRICTION_TIMESCALE:
|
case Vehicle.ANGULAR_FRICTION_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
vd.m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
||||||
break;
|
break;
|
||||||
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
case Vehicle.ANGULAR_MOTOR_DIRECTION:
|
||||||
m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
|
vd.m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
|
||||||
len = m_angularMotorDirection.Length();
|
len = vd.m_angularMotorDirection.Length();
|
||||||
if (len > 12.566f)
|
if (len > 12.566f)
|
||||||
m_angularMotorDirection *= (12.566f / len);
|
vd.m_angularMotorDirection *= (12.566f / len);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||||
if (pValue < timestep) pValue = timestep;
|
if (pValue < timestep) pValue = timestep;
|
||||||
m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
vd.m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_DIRECTION:
|
case Vehicle.LINEAR_MOTOR_DIRECTION:
|
||||||
m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
|
vd.m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
|
||||||
len = m_linearMotorDirection.Length();
|
len = vd.m_linearMotorDirection.Length();
|
||||||
if (len > 30.0f)
|
if (len > 30.0f)
|
||||||
m_linearMotorDirection *= (30.0f / len);
|
vd.m_linearMotorDirection *= (30.0f / len);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||||
m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
|
vd.m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
|
||||||
len = m_linearMotorOffset.Length();
|
len = vd.m_linearMotorOffset.Length();
|
||||||
if (len > 100.0f)
|
if (len > 100.0f)
|
||||||
m_linearMotorOffset *= (100.0f / len);
|
vd.m_linearMotorOffset *= (100.0f / len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}//end ProcessFloatVehicleParam
|
}//end ProcessFloatVehicleParam
|
||||||
|
@ -207,32 +215,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pValue.Y < timestep) pValue.Y = timestep;
|
if (pValue.Y < timestep) pValue.Y = timestep;
|
||||||
if (pValue.Z < timestep) pValue.Z = timestep;
|
if (pValue.Z < timestep) pValue.Z = timestep;
|
||||||
|
|
||||||
m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
vd.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);
|
vd.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
|
||||||
len = m_angularMotorDirection.Length();
|
len = vd.m_angularMotorDirection.Length();
|
||||||
if (len > 12.566f)
|
if (len > 12.566f)
|
||||||
m_angularMotorDirection *= (12.566f / len);
|
vd.m_angularMotorDirection *= (12.566f / len);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||||
if (pValue.X < timestep) pValue.X = timestep;
|
if (pValue.X < timestep) pValue.X = timestep;
|
||||||
if (pValue.Y < timestep) pValue.Y = timestep;
|
if (pValue.Y < timestep) pValue.Y = timestep;
|
||||||
if (pValue.Z < timestep) pValue.Z = timestep;
|
if (pValue.Z < timestep) pValue.Z = timestep;
|
||||||
m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
vd.m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_DIRECTION:
|
case Vehicle.LINEAR_MOTOR_DIRECTION:
|
||||||
m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
vd.m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
len = m_linearMotorDirection.Length();
|
len = vd.m_linearMotorDirection.Length();
|
||||||
if (len > 30.0f)
|
if (len > 30.0f)
|
||||||
m_linearMotorDirection *= (30.0f / len);
|
vd.m_linearMotorDirection *= (30.0f / len);
|
||||||
break;
|
break;
|
||||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||||
m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
vd.m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||||
len = m_linearMotorOffset.Length();
|
len = vd.m_linearMotorOffset.Length();
|
||||||
if (len > 100.0f)
|
if (len > 100.0f)
|
||||||
m_linearMotorOffset *= (100.0f / len);
|
vd.m_linearMotorOffset *= (100.0f / len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}//end ProcessVectorVehicleParam
|
}//end ProcessVectorVehicleParam
|
||||||
|
@ -242,7 +250,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
switch (pParam)
|
switch (pParam)
|
||||||
{
|
{
|
||||||
case Vehicle.REFERENCE_FRAME:
|
case Vehicle.REFERENCE_FRAME:
|
||||||
m_referenceFrame = Quaternion.Inverse(pValue);
|
vd.m_referenceFrame = Quaternion.Inverse(pValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}//end ProcessRotationVehicleParam
|
}//end ProcessRotationVehicleParam
|
||||||
|
@ -251,169 +259,169 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (remove)
|
if (remove)
|
||||||
{
|
{
|
||||||
m_flags &= ~((VehicleFlag)pParam);
|
vd.m_flags &= ~((VehicleFlag)pParam);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_flags |= (VehicleFlag)pParam;
|
vd.m_flags |= (VehicleFlag)pParam;
|
||||||
}
|
}
|
||||||
}//end ProcessVehicleFlags
|
}//end ProcessVehicleFlags
|
||||||
|
|
||||||
public void ProcessTypeChange(Vehicle pType)
|
public void ProcessTypeChange(Vehicle pType)
|
||||||
{
|
{
|
||||||
m_linearMotorDirection = Vector3.Zero;
|
vd.m_linearMotorDirection = Vector3.Zero;
|
||||||
m_angularMotorDirection = Vector3.Zero;
|
vd.m_angularMotorDirection = Vector3.Zero;
|
||||||
|
|
||||||
m_linearMotorOffset = Vector3.Zero;
|
vd.m_linearMotorOffset = Vector3.Zero;
|
||||||
|
|
||||||
m_referenceFrame = Quaternion.Identity;
|
vd.m_referenceFrame = Quaternion.Identity;
|
||||||
|
|
||||||
// Set Defaults For Type
|
// Set Defaults For Type
|
||||||
m_type = pType;
|
vd.m_type = pType;
|
||||||
switch (pType)
|
switch (pType)
|
||||||
{
|
{
|
||||||
case Vehicle.TYPE_NONE: // none sense this will never exist
|
case Vehicle.TYPE_NONE: // none sense this will never exist
|
||||||
m_linearFrictionTimescale = new Vector3(1000, 1000, 1000);
|
vd.m_linearFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
m_linearMotorTimescale = 1000;
|
vd.m_linearMotorTimescale = 1000;
|
||||||
m_linearMotorDecayTimescale = 120;
|
vd.m_linearMotorDecayTimescale = 120;
|
||||||
m_angularMotorTimescale = 1000;
|
vd.m_angularMotorTimescale = 1000;
|
||||||
m_angularMotorDecayTimescale = 1000;
|
vd.m_angularMotorDecayTimescale = 1000;
|
||||||
m_VhoverHeight = 0;
|
vd.m_VhoverHeight = 0;
|
||||||
m_VhoverTimescale = 1000;
|
vd.m_VhoverTimescale = 1000;
|
||||||
m_VehicleBuoyancy = 0;
|
vd.m_VehicleBuoyancy = 0;
|
||||||
m_flags = (VehicleFlag)0;
|
vd.m_flags = (VehicleFlag)0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Vehicle.TYPE_SLED:
|
case Vehicle.TYPE_SLED:
|
||||||
m_linearFrictionTimescale = new Vector3(30, 1, 1000);
|
vd.m_linearFrictionTimescale = new Vector3(30, 1, 1000);
|
||||||
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
m_linearMotorTimescale = 1000;
|
vd.m_linearMotorTimescale = 1000;
|
||||||
m_linearMotorDecayTimescale = 120;
|
vd.m_linearMotorDecayTimescale = 120;
|
||||||
m_angularMotorTimescale = 1000;
|
vd.m_angularMotorTimescale = 1000;
|
||||||
m_angularMotorDecayTimescale = 120;
|
vd.m_angularMotorDecayTimescale = 120;
|
||||||
m_VhoverHeight = 0;
|
vd.m_VhoverHeight = 0;
|
||||||
m_VhoverEfficiency = 1;
|
vd.m_VhoverEfficiency = 1;
|
||||||
m_VhoverTimescale = 10;
|
vd.m_VhoverTimescale = 10;
|
||||||
m_VehicleBuoyancy = 0;
|
vd.m_VehicleBuoyancy = 0;
|
||||||
m_linearDeflectionEfficiency = 1;
|
vd.m_linearDeflectionEfficiency = 1;
|
||||||
m_linearDeflectionTimescale = 1;
|
vd.m_linearDeflectionTimescale = 1;
|
||||||
m_angularDeflectionEfficiency = 0;
|
vd.m_angularDeflectionEfficiency = 0;
|
||||||
m_angularDeflectionTimescale = 1000;
|
vd.m_angularDeflectionTimescale = 1000;
|
||||||
m_bankingEfficiency = 0;
|
vd.m_bankingEfficiency = 0;
|
||||||
m_bankingMix = 1;
|
vd.m_bankingMix = 1;
|
||||||
m_bankingTimescale = 10;
|
vd.m_bankingTimescale = 10;
|
||||||
m_flags &=
|
vd.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);
|
||||||
m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
|
vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_CAR:
|
case Vehicle.TYPE_CAR:
|
||||||
m_linearFrictionTimescale = new Vector3(100, 2, 1000);
|
vd.m_linearFrictionTimescale = new Vector3(100, 2, 1000);
|
||||||
m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
|
||||||
m_linearMotorTimescale = 1;
|
vd.m_linearMotorTimescale = 1;
|
||||||
m_linearMotorDecayTimescale = 60;
|
vd.m_linearMotorDecayTimescale = 60;
|
||||||
m_angularMotorTimescale = 1;
|
vd.m_angularMotorTimescale = 1;
|
||||||
m_angularMotorDecayTimescale = 0.8f;
|
vd.m_angularMotorDecayTimescale = 0.8f;
|
||||||
m_VhoverHeight = 0;
|
vd.m_VhoverHeight = 0;
|
||||||
m_VhoverEfficiency = 0;
|
vd.m_VhoverEfficiency = 0;
|
||||||
m_VhoverTimescale = 1000;
|
vd.m_VhoverTimescale = 1000;
|
||||||
m_VehicleBuoyancy = 0;
|
vd.m_VehicleBuoyancy = 0;
|
||||||
m_linearDeflectionEfficiency = 1;
|
vd.m_linearDeflectionEfficiency = 1;
|
||||||
m_linearDeflectionTimescale = 2;
|
vd.m_linearDeflectionTimescale = 2;
|
||||||
m_angularDeflectionEfficiency = 0;
|
vd.m_angularDeflectionEfficiency = 0;
|
||||||
m_angularDeflectionTimescale = 10;
|
vd.m_angularDeflectionTimescale = 10;
|
||||||
m_verticalAttractionEfficiency = 1f;
|
vd.m_verticalAttractionEfficiency = 1f;
|
||||||
m_verticalAttractionTimescale = 10f;
|
vd.m_verticalAttractionTimescale = 10f;
|
||||||
m_bankingEfficiency = -0.2f;
|
vd.m_bankingEfficiency = -0.2f;
|
||||||
m_bankingMix = 1;
|
vd.m_bankingMix = 1;
|
||||||
m_bankingTimescale = 1;
|
vd.m_bankingTimescale = 1;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
||||||
m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY |
|
vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY |
|
||||||
VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY);
|
VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_BOAT:
|
case Vehicle.TYPE_BOAT:
|
||||||
m_linearFrictionTimescale = new Vector3(10, 3, 2);
|
vd.m_linearFrictionTimescale = new Vector3(10, 3, 2);
|
||||||
m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
vd.m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
||||||
m_linearMotorTimescale = 5;
|
vd.m_linearMotorTimescale = 5;
|
||||||
m_linearMotorDecayTimescale = 60;
|
vd.m_linearMotorDecayTimescale = 60;
|
||||||
m_angularMotorTimescale = 4;
|
vd.m_angularMotorTimescale = 4;
|
||||||
m_angularMotorDecayTimescale = 4;
|
vd.m_angularMotorDecayTimescale = 4;
|
||||||
m_VhoverHeight = 0;
|
vd.m_VhoverHeight = 0;
|
||||||
m_VhoverEfficiency = 0.5f;
|
vd.m_VhoverEfficiency = 0.5f;
|
||||||
m_VhoverTimescale = 2;
|
vd.m_VhoverTimescale = 2;
|
||||||
m_VehicleBuoyancy = 1;
|
vd.m_VehicleBuoyancy = 1;
|
||||||
m_linearDeflectionEfficiency = 0.5f;
|
vd.m_linearDeflectionEfficiency = 0.5f;
|
||||||
m_linearDeflectionTimescale = 3;
|
vd.m_linearDeflectionTimescale = 3;
|
||||||
m_angularDeflectionEfficiency = 0.5f;
|
vd.m_angularDeflectionEfficiency = 0.5f;
|
||||||
m_angularDeflectionTimescale = 5;
|
vd.m_angularDeflectionTimescale = 5;
|
||||||
m_verticalAttractionEfficiency = 0.5f;
|
vd.m_verticalAttractionEfficiency = 0.5f;
|
||||||
m_verticalAttractionTimescale = 5f;
|
vd.m_verticalAttractionTimescale = 5f;
|
||||||
m_bankingEfficiency = -0.3f;
|
vd.m_bankingEfficiency = -0.3f;
|
||||||
m_bankingMix = 0.8f;
|
vd.m_bankingMix = 0.8f;
|
||||||
m_bankingTimescale = 1;
|
vd.m_bankingTimescale = 1;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
|
vd.m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
|
||||||
VehicleFlag.HOVER_GLOBAL_HEIGHT |
|
VehicleFlag.HOVER_GLOBAL_HEIGHT |
|
||||||
VehicleFlag.HOVER_UP_ONLY |
|
VehicleFlag.HOVER_UP_ONLY |
|
||||||
VehicleFlag.LIMIT_ROLL_ONLY);
|
VehicleFlag.LIMIT_ROLL_ONLY);
|
||||||
m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
|
vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
|
||||||
VehicleFlag.LIMIT_MOTOR_UP |
|
VehicleFlag.LIMIT_MOTOR_UP |
|
||||||
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);
|
vd.m_linearFrictionTimescale = new Vector3(200, 10, 5);
|
||||||
m_angularFrictionTimescale = new Vector3(20, 20, 20);
|
vd.m_angularFrictionTimescale = new Vector3(20, 20, 20);
|
||||||
m_linearMotorTimescale = 2;
|
vd.m_linearMotorTimescale = 2;
|
||||||
m_linearMotorDecayTimescale = 60;
|
vd.m_linearMotorDecayTimescale = 60;
|
||||||
m_angularMotorTimescale = 4;
|
vd.m_angularMotorTimescale = 4;
|
||||||
m_angularMotorDecayTimescale = 8;
|
vd.m_angularMotorDecayTimescale = 8;
|
||||||
m_VhoverHeight = 0;
|
vd.m_VhoverHeight = 0;
|
||||||
m_VhoverEfficiency = 0.5f;
|
vd.m_VhoverEfficiency = 0.5f;
|
||||||
m_VhoverTimescale = 1000;
|
vd.m_VhoverTimescale = 1000;
|
||||||
m_VehicleBuoyancy = 0;
|
vd.m_VehicleBuoyancy = 0;
|
||||||
m_linearDeflectionEfficiency = 0.5f;
|
vd.m_linearDeflectionEfficiency = 0.5f;
|
||||||
m_linearDeflectionTimescale = 0.5f;
|
vd.m_linearDeflectionTimescale = 0.5f;
|
||||||
m_angularDeflectionEfficiency = 1;
|
vd.m_angularDeflectionEfficiency = 1;
|
||||||
m_angularDeflectionTimescale = 2;
|
vd.m_angularDeflectionTimescale = 2;
|
||||||
m_verticalAttractionEfficiency = 0.9f;
|
vd.m_verticalAttractionEfficiency = 0.9f;
|
||||||
m_verticalAttractionTimescale = 2f;
|
vd.m_verticalAttractionTimescale = 2f;
|
||||||
m_bankingEfficiency = 1;
|
vd.m_bankingEfficiency = 1;
|
||||||
m_bankingMix = 0.7f;
|
vd.m_bankingMix = 0.7f;
|
||||||
m_bankingTimescale = 2;
|
vd.m_bankingTimescale = 2;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
|
vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
|
||||||
VehicleFlag.HOVER_TERRAIN_ONLY |
|
VehicleFlag.HOVER_TERRAIN_ONLY |
|
||||||
VehicleFlag.HOVER_GLOBAL_HEIGHT |
|
VehicleFlag.HOVER_GLOBAL_HEIGHT |
|
||||||
VehicleFlag.HOVER_UP_ONLY |
|
VehicleFlag.HOVER_UP_ONLY |
|
||||||
VehicleFlag.NO_DEFLECTION_UP |
|
VehicleFlag.NO_DEFLECTION_UP |
|
||||||
VehicleFlag.LIMIT_MOTOR_UP);
|
VehicleFlag.LIMIT_MOTOR_UP);
|
||||||
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
|
vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
|
||||||
break;
|
break;
|
||||||
case Vehicle.TYPE_BALLOON:
|
case Vehicle.TYPE_BALLOON:
|
||||||
m_linearFrictionTimescale = new Vector3(5, 5, 5);
|
vd.m_linearFrictionTimescale = new Vector3(5, 5, 5);
|
||||||
m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
vd.m_angularFrictionTimescale = new Vector3(10, 10, 10);
|
||||||
m_linearMotorTimescale = 5;
|
vd.m_linearMotorTimescale = 5;
|
||||||
m_linearMotorDecayTimescale = 60;
|
vd.m_linearMotorDecayTimescale = 60;
|
||||||
m_angularMotorTimescale = 6;
|
vd.m_angularMotorTimescale = 6;
|
||||||
m_angularMotorDecayTimescale = 10;
|
vd.m_angularMotorDecayTimescale = 10;
|
||||||
m_VhoverHeight = 5;
|
vd.m_VhoverHeight = 5;
|
||||||
m_VhoverEfficiency = 0.8f;
|
vd.m_VhoverEfficiency = 0.8f;
|
||||||
m_VhoverTimescale = 10;
|
vd.m_VhoverTimescale = 10;
|
||||||
m_VehicleBuoyancy = 1;
|
vd.m_VehicleBuoyancy = 1;
|
||||||
m_linearDeflectionEfficiency = 0;
|
vd.m_linearDeflectionEfficiency = 0;
|
||||||
m_linearDeflectionTimescale = 5;
|
vd.m_linearDeflectionTimescale = 5;
|
||||||
m_angularDeflectionEfficiency = 0;
|
vd.m_angularDeflectionEfficiency = 0;
|
||||||
m_angularDeflectionTimescale = 5;
|
vd.m_angularDeflectionTimescale = 5;
|
||||||
m_verticalAttractionEfficiency = 0f;
|
vd.m_verticalAttractionEfficiency = 0f;
|
||||||
m_verticalAttractionTimescale = 1000f;
|
vd.m_verticalAttractionTimescale = 1000f;
|
||||||
m_bankingEfficiency = 0;
|
vd.m_bankingEfficiency = 0;
|
||||||
m_bankingMix = 0.7f;
|
vd.m_bankingMix = 0.7f;
|
||||||
m_bankingTimescale = 5;
|
vd.m_bankingTimescale = 5;
|
||||||
m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
|
vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
|
||||||
VehicleFlag.HOVER_TERRAIN_ONLY |
|
VehicleFlag.HOVER_TERRAIN_ONLY |
|
||||||
VehicleFlag.HOVER_UP_ONLY |
|
VehicleFlag.HOVER_UP_ONLY |
|
||||||
VehicleFlag.NO_DEFLECTION_UP |
|
VehicleFlag.NO_DEFLECTION_UP |
|
||||||
VehicleFlag.LIMIT_MOTOR_UP);
|
VehicleFlag.LIMIT_MOTOR_UP);
|
||||||
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY |
|
vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY |
|
||||||
VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
VehicleFlag.HOVER_GLOBAL_HEIGHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +432,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// crap crap crap
|
// crap crap crap
|
||||||
if (ph == null) // what ??
|
if (ph == null) // what ??
|
||||||
return;
|
return;
|
||||||
|
ph.SetVehicle(vd);
|
||||||
|
/*
|
||||||
ph.VehicleType = (int)m_type;
|
ph.VehicleType = (int)m_type;
|
||||||
|
|
||||||
// Linear properties
|
// Linear properties
|
||||||
|
@ -465,6 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
ph.VehicleFlags(~(int)m_flags, true);
|
ph.VehicleFlags(~(int)m_flags, true);
|
||||||
ph.VehicleFlags((int)m_flags, false);
|
ph.VehicleFlags((int)m_flags, false);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1965,6 +1965,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public SceneObjectGroup Copy(bool userExposed)
|
public SceneObjectGroup Copy(bool userExposed)
|
||||||
{
|
{
|
||||||
|
m_dupeInProgress = true;
|
||||||
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
|
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
|
||||||
dupe.m_isBackedUp = false;
|
dupe.m_isBackedUp = false;
|
||||||
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
|
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
|
||||||
|
@ -2048,6 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ScheduleGroupForFullUpdate();
|
ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_dupeInProgress = false;
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs
|
* Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs
|
||||||
|
* Ubit 2012
|
||||||
* rolled into ODEPrim.cs
|
* rolled into ODEPrim.cs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@ using Ode.NET;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -254,6 +254,61 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
|
private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
|
||||||
|
|
||||||
SerialControl m_taintserial = null;
|
SerialControl m_taintserial = null;
|
||||||
|
object m_taintvehicledata = null;
|
||||||
|
|
||||||
|
public void DoSetVehicle()
|
||||||
|
{
|
||||||
|
VehicleData vd = (VehicleData)m_taintvehicledata;
|
||||||
|
|
||||||
|
m_type = vd.m_type;
|
||||||
|
m_flags = vd.m_flags;
|
||||||
|
|
||||||
|
// Linear properties
|
||||||
|
m_linearMotorDirection = vd.m_linearMotorDirection;
|
||||||
|
m_linearFrictionTimescale = vd.m_linearFrictionTimescale;
|
||||||
|
m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale;
|
||||||
|
m_linearMotorTimescale = vd.m_linearMotorTimescale;
|
||||||
|
// m_linearMotorOffset = vd.m_linearMotorOffset;
|
||||||
|
|
||||||
|
//Angular properties
|
||||||
|
m_angularMotorDirection = vd.m_angularMotorDirection;
|
||||||
|
m_angularMotorTimescale = vd.m_angularMotorTimescale;
|
||||||
|
m_angularMotorDecayTimescale = vd.m_angularMotorDecayTimescale;
|
||||||
|
m_angularFrictionTimescale = vd.m_angularFrictionTimescale;
|
||||||
|
|
||||||
|
//Deflection properties
|
||||||
|
// m_angularDeflectionEfficiency = vd.m_angularDeflectionEfficiency;
|
||||||
|
// m_angularDeflectionTimescale = vd.m_angularDeflectionTimescale;
|
||||||
|
// m_linearDeflectionEfficiency = vd.m_linearDeflectionEfficiency;
|
||||||
|
// m_linearDeflectionTimescale = vd.m_linearDeflectionTimescale;
|
||||||
|
|
||||||
|
//Banking properties
|
||||||
|
// m_bankingEfficiency = vd.m_bankingEfficiency;
|
||||||
|
// m_bankingMix = vd.m_bankingMix;
|
||||||
|
// m_bankingTimescale = vd.m_bankingTimescale;
|
||||||
|
|
||||||
|
//Hover and Buoyancy properties
|
||||||
|
m_VhoverHeight = vd.m_VhoverHeight;
|
||||||
|
// m_VhoverEfficiency = vd.m_VhoverEfficiency;
|
||||||
|
m_VhoverTimescale = vd.m_VhoverTimescale;
|
||||||
|
m_VehicleBuoyancy = vd.m_VehicleBuoyancy;
|
||||||
|
|
||||||
|
//Attractor properties
|
||||||
|
m_verticalAttractionEfficiency = vd.m_verticalAttractionEfficiency;
|
||||||
|
m_verticalAttractionTimescale = vd.m_verticalAttractionTimescale;
|
||||||
|
|
||||||
|
// Axis
|
||||||
|
// m_referenceFrame = vd.m_referenceFrame;
|
||||||
|
|
||||||
|
|
||||||
|
m_taintvehicledata = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetVehicle(object vdata)
|
||||||
|
{
|
||||||
|
m_taintvehicledata = vdata;
|
||||||
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
|
}
|
||||||
|
|
||||||
public override byte[] Serialize(bool PhysIsRunning)
|
public override byte[] Serialize(bool PhysIsRunning)
|
||||||
{
|
{
|
||||||
|
@ -1843,6 +1898,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (m_taintCollidesWater != m_collidesWater)
|
if (m_taintCollidesWater != m_collidesWater)
|
||||||
changefloatonwater(timestep);
|
changefloatonwater(timestep);
|
||||||
|
|
||||||
|
if (m_taintvehicledata != null)
|
||||||
|
DoSetVehicle();
|
||||||
|
|
||||||
if (m_taintserial != null)
|
if (m_taintserial != null)
|
||||||
DoSerialize(m_taintserial);
|
DoSerialize(m_taintserial);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
// adapted from libomv removing cpu endian adjust
|
/* Ubit 2012
|
||||||
// for prims lowlevel serialization
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// no endian conversion. So can't be use to pass information around diferent cpus with diferent endian
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -7,77 +19,168 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
public class wstreamer
|
|
||||||
|
unsafe public class wstreamer
|
||||||
{
|
{
|
||||||
private MemoryStream st;
|
byte[] buf;
|
||||||
|
int index;
|
||||||
|
byte* src;
|
||||||
|
|
||||||
public wstreamer()
|
public wstreamer()
|
||||||
{
|
{
|
||||||
st = new MemoryStream();
|
buf = new byte[1024];
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
public wstreamer(int size)
|
||||||
|
{
|
||||||
|
buf = new byte[size];
|
||||||
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] close()
|
public byte[] close()
|
||||||
{
|
{
|
||||||
byte[] data = st.ToArray();
|
byte[] data = new byte[index];
|
||||||
st.Close();
|
Buffer.BlockCopy(buf, 0, data, 0, index);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Seek(int pos)
|
||||||
|
{
|
||||||
|
index = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Seekrel(int pos)
|
||||||
|
{
|
||||||
|
index += pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Wbyte(byte value)
|
||||||
|
{
|
||||||
|
buf[index++] = value;
|
||||||
|
}
|
||||||
public void Wshort(short value)
|
public void Wshort(short value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 2);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wushort(ushort value)
|
public void Wushort(ushort value)
|
||||||
{
|
{
|
||||||
byte[] t = BitConverter.GetBytes(value);
|
src = (byte*)&value;
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 2);
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wint(int value)
|
public void Wint(int value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 4);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wuint(uint value)
|
public void Wuint(uint value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 4);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wlong(long value)
|
public void Wlong(long value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 8);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wulong(ulong value)
|
public void Wulong(ulong value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 8);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Wfloat(float value)
|
public void Wfloat(float value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 4);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Wdouble(double value)
|
public void Wdouble(double value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value), 0, 8);
|
src = (byte*)&value;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Wvector3(Vector3 value)
|
public void Wvector3(Vector3 value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value.X), 0, 4);
|
src = (byte*)&value.X;
|
||||||
st.Write(BitConverter.GetBytes(value.Y), 0, 4);
|
buf[index++] = *src++;
|
||||||
st.Write(BitConverter.GetBytes(value.Z), 0, 4);
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
|
src = (byte*)&value.Y; // it may have padding ??
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
|
src = (byte*)&value.Z;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
public void Wquat(Quaternion value)
|
public void Wquat(Quaternion value)
|
||||||
{
|
{
|
||||||
st.Write(BitConverter.GetBytes(value.X), 0, 4);
|
src = (byte*)&value.X;
|
||||||
st.Write(BitConverter.GetBytes(value.Y), 0, 4);
|
buf[index++] = *src++;
|
||||||
st.Write(BitConverter.GetBytes(value.Z), 0, 4);
|
buf[index++] = *src++;
|
||||||
st.Write(BitConverter.GetBytes(value.W), 0, 4);
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
|
src = (byte*)&value.Y; // it may have padding ??
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
|
src = (byte*)&value.Z;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
|
src = (byte*)&value.W;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src++;
|
||||||
|
buf[index++] = *src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class rstreamer
|
unsafe public class rstreamer
|
||||||
{
|
{
|
||||||
private byte[] rbuf;
|
private byte[] rbuf;
|
||||||
private int ptr;
|
private int ptr;
|
||||||
|
private byte* dst;
|
||||||
|
|
||||||
public rstreamer(byte[] data)
|
public rstreamer(byte[] data)
|
||||||
{
|
{
|
||||||
|
@ -89,78 +192,161 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Seek(int pos)
|
||||||
|
{
|
||||||
|
ptr = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Seekrel(int pos)
|
||||||
|
{
|
||||||
|
ptr += pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte Rbyte()
|
||||||
|
{
|
||||||
|
return (byte)rbuf[ptr++];
|
||||||
|
}
|
||||||
|
|
||||||
public short Rshort()
|
public short Rshort()
|
||||||
{
|
{
|
||||||
short v = BitConverter.ToInt16(rbuf, ptr);
|
short v;
|
||||||
ptr += 2;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public ushort Rushort()
|
public ushort Rushort()
|
||||||
{
|
{
|
||||||
ushort v = BitConverter.ToUInt16(rbuf, ptr);
|
ushort v;
|
||||||
ptr += 2;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public int Rint()
|
public int Rint()
|
||||||
{
|
{
|
||||||
int v = BitConverter.ToInt32(rbuf, ptr);
|
int v;
|
||||||
ptr += 4;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public uint Ruint()
|
public uint Ruint()
|
||||||
{
|
{
|
||||||
uint v = BitConverter.ToUInt32(rbuf, ptr);
|
uint v;
|
||||||
ptr += 4;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public long Rlong()
|
public long Rlong()
|
||||||
{
|
{
|
||||||
long v = BitConverter.ToInt64(rbuf, ptr);
|
long v;
|
||||||
ptr += 8;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public ulong Rulong()
|
public ulong Rulong()
|
||||||
{
|
{
|
||||||
ulong v = BitConverter.ToUInt64(rbuf, ptr);
|
ulong v;
|
||||||
ptr += 8;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
public float Rfloat()
|
public float Rfloat()
|
||||||
{
|
{
|
||||||
float v = BitConverter.ToSingle(rbuf, ptr);
|
float v;
|
||||||
ptr += 4;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Rdouble()
|
public double Rdouble()
|
||||||
{
|
{
|
||||||
double v = BitConverter.ToDouble(rbuf, ptr);
|
double v;
|
||||||
ptr += 8;
|
dst = (byte*)&v;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 Rvector3()
|
public Vector3 Rvector3()
|
||||||
{
|
{
|
||||||
Vector3 v;
|
Vector3 v;
|
||||||
v.X = BitConverter.ToSingle(rbuf, ptr);
|
dst = (byte*)&v.X;
|
||||||
ptr += 4;
|
*dst++ = rbuf[ptr++];
|
||||||
v.Y = BitConverter.ToSingle(rbuf, ptr);
|
*dst++ = rbuf[ptr++];
|
||||||
ptr += 4;
|
*dst++ = rbuf[ptr++];
|
||||||
v.Z = BitConverter.ToSingle(rbuf, ptr);
|
*dst = rbuf[ptr++];
|
||||||
ptr += 4;
|
|
||||||
|
dst = (byte*)&v.Y;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
|
|
||||||
|
dst = (byte*)&v.Z;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Quaternion Rquat()
|
public Quaternion Rquat()
|
||||||
{
|
{
|
||||||
Quaternion v;
|
Quaternion v;
|
||||||
v.X = BitConverter.ToSingle(rbuf, ptr);
|
dst = (byte*)&v.X;
|
||||||
ptr += 4;
|
*dst++ = rbuf[ptr++];
|
||||||
v.Y = BitConverter.ToSingle(rbuf, ptr);
|
*dst++ = rbuf[ptr++];
|
||||||
ptr += 4;
|
*dst++ = rbuf[ptr++];
|
||||||
v.Z = BitConverter.ToSingle(rbuf, ptr);
|
*dst = rbuf[ptr++];
|
||||||
ptr += 4;
|
|
||||||
v.W = BitConverter.ToSingle(rbuf, ptr);
|
dst = (byte*)&v.Y;
|
||||||
ptr += 4;
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
|
|
||||||
|
dst = (byte*)&v.Z;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
|
|
||||||
|
dst = (byte*)&v.W;
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst++ = rbuf[ptr++];
|
||||||
|
*dst = rbuf[ptr++];
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event CollisionUpdate OnCollisionUpdate;
|
public event CollisionUpdate OnCollisionUpdate;
|
||||||
|
|
||||||
|
public virtual void SetVehicle(object vdata) { }
|
||||||
|
|
||||||
public event OutOfBounds OnOutOfBounds;
|
public event OutOfBounds OnOutOfBounds;
|
||||||
#pragma warning restore 67
|
#pragma warning restore 67
|
||||||
|
|
||||||
|
@ -153,8 +155,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
get { return new NullPhysicsActor(); }
|
get { return new NullPhysicsActor(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual bool Building { get; set; }
|
public virtual bool Building { get; set; }
|
||||||
|
|
||||||
public virtual ContactData ContactData
|
public virtual ContactData ContactData
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
|
@ -117,5 +118,47 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
NO_DEFLECTION = 16392,
|
NO_DEFLECTION = 16392,
|
||||||
LOCK_ROTATION = 32784
|
LOCK_ROTATION = 32784
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct VehicleData
|
||||||
|
{
|
||||||
|
public Vehicle m_type;
|
||||||
|
public VehicleFlag m_flags;
|
||||||
|
|
||||||
|
// Linear properties
|
||||||
|
public Vector3 m_linearMotorDirection;
|
||||||
|
public Vector3 m_linearFrictionTimescale;
|
||||||
|
public float m_linearMotorDecayTimescale;
|
||||||
|
public float m_linearMotorTimescale;
|
||||||
|
public Vector3 m_linearMotorOffset;
|
||||||
|
|
||||||
|
//Angular properties
|
||||||
|
public Vector3 m_angularMotorDirection;
|
||||||
|
public float m_angularMotorTimescale;
|
||||||
|
public float m_angularMotorDecayTimescale;
|
||||||
|
public Vector3 m_angularFrictionTimescale;
|
||||||
|
|
||||||
|
//Deflection properties
|
||||||
|
public float m_angularDeflectionEfficiency;
|
||||||
|
public float m_angularDeflectionTimescale;
|
||||||
|
public float m_linearDeflectionEfficiency;
|
||||||
|
public float m_linearDeflectionTimescale;
|
||||||
|
|
||||||
|
//Banking properties
|
||||||
|
public float m_bankingEfficiency;
|
||||||
|
public float m_bankingMix;
|
||||||
|
public float m_bankingTimescale;
|
||||||
|
|
||||||
|
//Hover and Buoyancy properties
|
||||||
|
public float m_VhoverHeight;
|
||||||
|
public float m_VhoverEfficiency;
|
||||||
|
public float m_VhoverTimescale;
|
||||||
|
public float m_VehicleBuoyancy;
|
||||||
|
|
||||||
|
//Attractor properties
|
||||||
|
public float m_verticalAttractionEfficiency;
|
||||||
|
public float m_verticalAttractionTimescale;
|
||||||
|
|
||||||
|
// Axis
|
||||||
|
public Quaternion m_referenceFrame;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue