vehicle changes done by simulation thread and not calling one
parent
3f9c390b4d
commit
d4e28ed113
|
@ -25,7 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Revision 2011 by Ubit Umarov
|
||||
/* Revision 2011/12 by Ubit Umarov
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -225,19 +225,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
get
|
||||
{
|
||||
/*
|
||||
ODEDynamics v;
|
||||
if(childPrim && _parent !=null)
|
||||
{
|
||||
v =((OdePrim)_parent).m_vehicle;
|
||||
if(v != null && v.Type != Vehicle.TYPE_NONE)
|
||||
return v.VehiculeContactData;
|
||||
return primContactData;
|
||||
}
|
||||
|
||||
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
return m_vehicle.VehiculeContactData;
|
||||
*/
|
||||
return primContactData;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +387,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public override void SetVolumeDetect(int param)
|
||||
{
|
||||
AddChange(changes.VolumeDtc, (param != 0));
|
||||
|
@ -483,14 +469,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// client object interpolation works a 'little' better
|
||||
if (_zeroFlag)
|
||||
return Vector3.Zero;
|
||||
/*
|
||||
Vector3 returnVelocity = Vector3.Zero;
|
||||
returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
|
||||
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
|
||||
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
|
||||
|
||||
return returnVelocity;
|
||||
*/
|
||||
return _velocity;
|
||||
}
|
||||
set
|
||||
|
@ -652,6 +630,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
public override int VehicleType
|
||||
{
|
||||
// we may need to put a fake on this
|
||||
get
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
|
@ -661,44 +640,32 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
set
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
{
|
||||
if (value != (int)Vehicle.TYPE_NONE)
|
||||
{
|
||||
m_vehicle = new ODEDynamics(this);
|
||||
m_vehicle.ProcessTypeChange((Vehicle)value);
|
||||
}
|
||||
}
|
||||
else
|
||||
m_vehicle.ProcessTypeChange((Vehicle)value);
|
||||
AddChange(changes.VehicleType, value);
|
||||
}
|
||||
}
|
||||
|
||||
public override void VehicleFloatParam(int param, float value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
strVehicleFloatParam fp = new strVehicleFloatParam();
|
||||
fp.param = param;
|
||||
fp.value = value;
|
||||
AddChange(changes.VehicleFloatParam, fp);
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
strVehicleVectorParam fp = new strVehicleVectorParam();
|
||||
fp.param = param;
|
||||
fp.value = value;
|
||||
AddChange(changes.VehicleVectorParam, fp);
|
||||
}
|
||||
|
||||
public override void VehicleRotationParam(int param, Quaternion rotation)
|
||||
public override void VehicleRotationParam(int param, Quaternion value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
strVehicleQuatParam fp = new strVehicleQuatParam();
|
||||
fp.param = param;
|
||||
fp.value = value;
|
||||
AddChange(changes.VehicleVectorParam, fp);
|
||||
}
|
||||
|
||||
public override void VehicleFlags(int param, bool remove)
|
||||
|
@ -2609,6 +2576,57 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
private void changeVehicleType(int value)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
{
|
||||
if (value != (int)Vehicle.TYPE_NONE)
|
||||
{
|
||||
m_vehicle = new ODEDynamics(this);
|
||||
m_vehicle.ProcessTypeChange((Vehicle)value);
|
||||
}
|
||||
}
|
||||
else
|
||||
m_vehicle.ProcessTypeChange((Vehicle)value);
|
||||
}
|
||||
|
||||
private void changeVehicleFloatParam(strVehicleFloatParam fp)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
|
||||
m_vehicle.ProcessFloatVehicleParam((Vehicle)fp.param, fp.value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
}
|
||||
|
||||
private void changeVehicleVectorParam(strVehicleVectorParam vp)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessVectorVehicleParam((Vehicle)vp.param, vp.value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
}
|
||||
|
||||
private void changeVehicleRotationParam(strVehicleQuatParam qp)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessRotationVehicleParam((Vehicle)qp.param, qp.value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
}
|
||||
|
||||
private void changeVehicleFlags(strVehicleBoolParam bp)
|
||||
{
|
||||
if (m_vehicle == null)
|
||||
return;
|
||||
m_vehicle.ProcessVehicleFlags(bp.param, bp.value);
|
||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||
d.BodyEnable(Body);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Move()
|
||||
|
@ -3236,6 +3254,26 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
changeBuilding((bool)arg);
|
||||
break;
|
||||
|
||||
case changes.VehicleType:
|
||||
changeVehicleType((int)arg);
|
||||
break;
|
||||
|
||||
case changes.VehicleFlags:
|
||||
changeVehicleFlags((strVehicleBoolParam) arg);
|
||||
break;
|
||||
|
||||
case changes.VehicleFloatParam:
|
||||
changeVehicleFloatParam((strVehicleFloatParam) arg);
|
||||
break;
|
||||
|
||||
case changes.VehicleVectorParam:
|
||||
changeVehicleVectorParam((strVehicleVectorParam) arg);
|
||||
break;
|
||||
|
||||
case changes.VehicleRotationParam:
|
||||
changeVehicleRotationParam((strVehicleQuatParam) arg);
|
||||
break;
|
||||
|
||||
case changes.Null:
|
||||
donullchange();
|
||||
break;
|
||||
|
@ -3251,5 +3289,30 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
_parent_scene.AddChange(this, what, arg);
|
||||
}
|
||||
|
||||
|
||||
private struct strVehicleBoolParam
|
||||
{
|
||||
public int param;
|
||||
public bool value;
|
||||
}
|
||||
|
||||
private struct strVehicleFloatParam
|
||||
{
|
||||
public int param;
|
||||
public float value;
|
||||
}
|
||||
|
||||
private struct strVehicleQuatParam
|
||||
{
|
||||
public int param;
|
||||
public Quaternion value;
|
||||
}
|
||||
|
||||
private struct strVehicleVectorParam
|
||||
{
|
||||
public int param;
|
||||
public Vector3 value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
|
@ -137,6 +136,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
disabled,
|
||||
building,
|
||||
|
||||
VehicleType,
|
||||
VehicleFloatParam,
|
||||
VehicleVectorParam,
|
||||
VehicleRotationParam,
|
||||
VehicleFlags,
|
||||
|
||||
Null //keep this last used do dim the methods array. does nothing but pulsing the prim
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue