<HTML>
<HEAD>
<TITLE>OpenSim Crashes when running a small Vehicle Script</TITLE>
</HEAD>
<BODY>
<FONT SIZE="2"><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10pt'>I've wrote a small, very easy Script to drive a Vehicle. But everytime I get and like to drive, OpenSim crashes.<BR>
<BR>
Any ideas?<BR>
<BR>
Thanks<BR>
<BR>
Tom<BR>
<BR>
BELOW: Crash and Code:<BR>
<BR>
<BR>
The crash is:<BR>
<BR>
Region (root) # Stacktrace:<BR>
<BR>
at (wrapper managed-to-native) Ode.NET.d.JointSetLMotorAxis (intptr,int,int,single,single,single) <0x00004><BR>
at (wrapper managed-to-native) Ode.NET.d.JointSetLMotorAxis (intptr,int,int,single,single,single) <0xffffffff><BR>
at OpenSim.Region.Physics.OdePlugin.ODEVehicleSettings.SetLinearMotorProperties () <0x001e6><BR>
at OpenSim.Region.Physics.OdePlugin.ODEVehicleSettings.LinearMotor (single) <0x004aa><BR>
at OpenSim.Region.Physics.OdePlugin.ODEVehicleSettings.Step (single) <0x0009b><BR>
at OpenSim.Region.Physics.OdePlugin.OdePrim.Move (single) <0x00b20><BR>
at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x0155f><BR>
at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x0003c><BR>
at OpenSim.Region.Framework.Scenes.Scene.Update () <0x004d5><BR>
at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00018><BR>
at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff><BR>
Abort trap<BR>
<BR>
<BR>
The Script is:<BR>
// set the vehicle parameters<BR>
setupVehicle()<BR>
{<BR>
llSetStatus(STATUS_PHYSICS, TRUE);<BR>
llSetVehicleType(VEHICLE_TYPE_CAR);<BR>
<BR>
// The vehicle will get up to full speed in 1 second<BR>
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);<BR>
<BR>
// The motor will become ineffective after 3 seconds.<BR>
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 3.0);<BR>
<BR>
// Turn off angular and linear deflection <BR>
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.0);<BR>
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.0);<BR>
<BR>
// Set low linear friction, equal in all directions<BR>
llSetVehicleFloatParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, 5000.0);<BR>
<BR>
// Set very high angular friction, this vehicle does not <BR>
// like to turn<BR>
llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, 0.1); <BR>
}<BR>
<BR>
// stop this object from being a vehicle<BR>
noVehicle()<BR>
{<BR>
// Turn off physics and vehicle params<BR>
llSetVehicleType(VEHICLE_TYPE_NONE);<BR>
llSetStatus(STATUS_PHYSICS, FALSE);<BR>
}<BR>
<BR>
// give this prim a wedge shape and set it to about avatar size<BR>
setupObject()<BR>
{<BR>
llSetPrimitiveParams([<BR>
PRIM_TYPE, <BR>
PRIM_TYPE_BOX,<BR>
PRIM_HOLE_DEFAULT,<BR>
<0.75, 1.0, 0.0>,<BR>
0.0,<BR>
<0.0, 0.0, 0.0>,<BR>
<1.0, 1.0, 0.0>,<BR>
<0.0, 0.0, 0.0>,<BR>
PRIM_SIZE,<BR>
<4.0, 1.5, 0.5><BR>
]);<BR>
}<BR>
<BR>
// default state, not a vehicle<BR>
default<BR>
{<BR>
state_entry()<BR>
{<BR>
noVehicle();<BR>
setupObject();<BR>
<BR>
// Set the location avatars will sit<BR>
llSitTarget(<-1.0, 0.0, 0.5>, ZERO_ROTATION);<BR>
}<BR>
<BR>
changed(integer change)<BR>
{<BR>
if (change & CHANGED_LINK)<BR>
{<BR>
if (llAvatarOnSitTarget() != NULL_KEY)<BR>
{<BR>
// someone is sitting on the object; request permission<BR>
// to take controls<BR>
llRequestPermissions(<BR>
llAvatarOnSitTarget(),<BR>
PERMISSION_TAKE_CONTROLS); <BR>
}<BR>
}<BR>
}<BR>
<BR>
run_time_permissions(integer perm)<BR>
{<BR>
// the run time permissions have changed; if script can <BR>
// take controls, do that and go to the vehicle state<BR>
if (perm & PERMISSION_TAKE_CONTROLS)<BR>
{<BR>
llTakeControls(<BR>
CONTROL_FWD | CONTROL_BACK | <BR>
CONTROL_LEFT | CONTROL_RIGHT | <BR>
CONTROL_ROT_LEFT |CONTROL_ROT_RIGHT,<BR>
TRUE, FALSE);<BR>
state vehicle;<BR>
}<BR>
}<BR>
}<BR>
<BR>
state vehicle<BR>
{<BR>
state_entry()<BR>
{<BR>
setupVehicle();<BR>
}<BR>
<BR>
changed(integer change)<BR>
{<BR>
// If the avatar sitting on this object gets up, stop <BR>
// being a vehicle<BR>
if (change & CHANGED_LINK)<BR>
{<BR>
if (llAvatarOnSitTarget() == NULL_KEY)<BR>
{<BR>
// no one is sitting on the object; stop <BR>
// being a vehicle<BR>
llReleaseControls();<BR>
state default;<BR>
}<BR>
}<BR>
}<BR>
<BR>
control(key from, integer level, integer edge)<BR>
{<BR>
integer pressed = (level & edge);<BR>
vector velocity = ZERO_VECTOR;<BR>
float speed = 15.0;<BR>
<BR>
if (pressed & CONTROL_FWD)<BR>
{<BR>
velocity = <1.0, 0.0, 0.0>;<BR>
}<BR>
else if (pressed & CONTROL_BACK)<BR>
{<BR>
velocity = <-1.0, 0.0, 0.0>;<BR>
} <BR>
else if (pressed & CONTROL_LEFT || <BR>
pressed & CONTROL_ROT_LEFT)<BR>
{<BR>
velocity = <0.0, 1.0, 0.0>;<BR>
}<BR>
else if (pressed & CONTROL_RIGHT || <BR>
pressed & CONTROL_ROT_RIGHT)<BR>
{<BR>
velocity = <0.0, -1.0, 0.0>;<BR>
}<BR>
if (velocity != ZERO_VECTOR)<BR>
{<BR>
velocity = velocity * speed;<BR>
llSetVehicleVectorParam(<BR>
VEHICLE_LINEAR_MOTOR_DIRECTION, <BR>
velocity);<BR>
} <BR>
}<BR>
}</SPAN></FONT></FONT>
</BODY>
</HTML>