Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- default
- {
- state_entry()
- {
- llPassCollisions(TRUE);
- llSetSitText("Ride");
- vector input = <0.0, 0.0, 270.0> * DEG_TO_RAD;
- rotation rot = llEuler2Rot(input);
- llSitTarget(<0.6, 0.03, 0.20>, llGetRot()*rot);
- llSetCameraEyeOffset(<-5.0, -0.00, 2.0>);
- llSetCameraAtOffset(<3.0, 0.0, 2.0>);
- llSetVehicleType(VEHICLE_TYPE_CAR);
- llSetVehicleFlags(VEHICLE_FLAG_NO_DEFLECTION_UP |
- VEHICLE_FLAG_LIMIT_ROLL_ONLY | VEHICLE_FLAG_LIMIT_MOTOR_UP);
- llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);
- llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);
- llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.10);
- llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);
- llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
- llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.5); // how far the vehicle travels after releasing the control buttons
- llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 1.0);
- llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.8);
- llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE,
- <100.0, 2.0, 1000.0>);
- llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE,
- <1000.0, 1000.0, 1000.0>);
- llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY,
- 5.00);
- llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE,
- 10.00);
- llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 0.0);
- llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.0);
- llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 0.0);
- llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
- llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 );
- llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000 );
- llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0 );
- llCollisionSound("", 0.0);
- }
- changed(integer change)
- {
- if (change & CHANGED_LINK)
- {
- key agent = llAvatarOnSitTarget();
- if (agent)
- {
- llSetStatus(STATUS_PHYSICS, TRUE);
- llRequestPermissions(agent,
- PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
- llMessageLinked(LINK_SET, 0, "get_on", "");
- }
- else
- {
- llSetStatus(STATUS_PHYSICS, FALSE);
- llReleaseControls();
- llStopAnimation("motorcycle_sit");
- llMessageLinked(LINK_SET, 0, "idle", "");
- }
- }
- }
- run_time_permissions(integer perm)
- {
- if (perm)
- {
- llStartAnimation("motorcycle_sit");
- llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT |
- CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
- }
- }
- control(key id, integer level, integer edge)
- {
- vector angular_motor;
- if(level & CONTROL_FWD)
- {
- llOwnerSay("forward");
- llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,
- <15,0,0>); //speed of car
- }
- if(level & CONTROL_BACK)
- {
- llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION,
- <-15,0,0>);
- }
- if(level & CONTROL_FWD|| level & CONTROL_BACK && level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
- {
- angular_motor.x += PI*6;
- angular_motor.z -= PI*6;
- // angular_motor.x += PI;
- // angular_motor.z -= PI;
- }
- if(level & CONTROL_FWD|| level & CONTROL_BACK && level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
- {
- angular_motor.x -= PI*6;
- angular_motor.z += PI*6;
- }
- if(level & (CONTROL_UP))
- {
- angular_motor.y -= 50;
- }
- if((edge & CONTROL_FWD) && (level & CONTROL_FWD))
- {
- llMessageLinked(LINK_SET, 0, "burst", "");
- }
- if((edge & CONTROL_FWD) && !(level & CONTROL_FWD))
- {
- llMessageLinked(LINK_SET, 0, "stop", "");
- }
- llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,
- angular_motor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement