The problem is I don't know how to modify this script in this way, but I suspect it has to do with tweaking the following. (but I could be wrong)
VEHICLE_LINEAR_FRICTION_TIMESCALE
VEHICLE_LINEAR_MOTOR_TIMESCALE
VEHICLE_LINEAR_MOTOR_DIRECTION
Now I think I got the VEHICLE_LINEAR_MOTOR_DIRECTION figured out. I think this controls the max speed of the vehicle and I figured that a formula like (MPH you want to go x 2.23694) will output the correct number in Meters Per Second. My code I will show will reflect this, but what about the VEHICLE_LINEAR_FRICTION_TIMESCALE and VEHICLE_LINEAR_MOTOR_TIMESCALE. Can you come up with any formulas or strategies to make these behave within the paramaters I specified above? Here is the vehicle code.
CODE
default
{
state_entry ()
{
llPassCollisions(TRUE);
llPassTouches(FALSE);
llSetSitText("Ride");
llSitTarget(<0.6,0,0.25>, ZERO_ROTATION);
llSetCameraEyeOffset(<-7.0, 0.0, 1.0>);
llSetCameraAtOffset(<3.0, 0.0, 2.0>);
llSetVehicleType(VEHICLE_TYPE_CAR);
llSetVehicleFlags(VEHICLE_FLAG_CAMERA_DECOUPLED
| VEHICLE_FLAG_LIMIT_MOTOR_UP
| VEHICLE_FLAG_MOUSELOOK_BANK
);
//Controls how easy it glides along the ground.
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 0.0, 1000> );
//Controls how easy the vehicle rotates.
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 0> );
//Determines how long it takes for the motor to push the vehicle to full speed.
//Its minimum value is approximately 0.06 seconds.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 2 );
//Controls the deceleration to zero velocity from the time you let go of the pedal.
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.0);
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.0 );
//Controls the max turning rate.
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <1000, 1000, 0> );
//Controls the time it takes for the turning rate to accelerate to max velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.0 );
//Controls the time it takes for the turning rate to decelerate to zero velocity.
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.0 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.0 );
//Controls how strong the force for the bike to remain vertical
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.50 );
//Controls the time it takes for the bike to lean.
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.50);
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_MIX, 1.0 );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 0.0 );
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
if (agent != llGetOwner())
{
llSay(0, "You are not the owner of this vehicle. Please step away.");
llUnSit(agent);
llPushObject(agent,<0,0,10>, ZERO_VECTOR, FALSE);
}
else
{
llSetStatus(STATUS_PHYSICS, TRUE);
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
llOwnerSay("'W' Accelerates, 'S' Decelerates/Reverse. Steer by looking in the direction you want to go.");
}
}
//... Permissions may already be revoked on standing ...
else
{
integer p = llGetPermissions();
llSetStatus(STATUS_PHYSICS, FALSE);
if(p & PERMISSION_TAKE_CONTROLS)
{
llReleaseControls();
}
if(p & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("motorcycle_sit");
}
}
}
}
//... may be called multiple times ...
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("motorcycle_sit");
}
if(perm & PERMISSION_TAKE_CONTROLS)
llTakeControls(CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}
control(key id, integer level, integer edge)
{
if(level & CONTROL_FWD)
{
//This sets the max velocity the vehicle will achive by meters/second (miles per hour you want to go x 2.23694 = meters per second value)
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<140*2.23694,0,0>);
}
if(level & CONTROL_BACK)
{
//This sets the max velocity the vehicle will achive by meters/second (miles per hour you want to go x 2.23694 = meters per second value)
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,<-140*2.23694,0,0>);
}
}
}
Also if you see any errors in the comments, please point them out so I can have the right changes?