How to Make a Car in SL

Finding a Sandbox

In this tutorial, we will guide you through the steps to make a prim drivable in the Second Life virtual world, turning objects into interactive, functional vehicles. The journey begins by finding a suitable location for your creative process, ideally a sandbox. Sandboxes in Second Life are designated areas where users are free to build and script without affecting the main areas, providing a perfect environment for experimentation and development. Teleport to one of the following sandboxes to begin building your car!

Sandbox locations:

Setting Up Your Car Prim

Once you've teleported to your sandbox, the next step involves utilizing Linden Scripting Language (LSL) to bring your prim to life. Copy the LSL script from this tutorial and be ready to put it into a new script in Second Life.

LSL Car Script

                //**********************************************
//Title: Car
//Author: Aaron Perkins
//Date: 3/17/2004
//
// Modified by tototol Resident on Mar 26, 2024
// pruned and cleaned script
//**********************************************

// Feel free to modify these basic parameters to suit your needs.
float forward_power = 30; // Power used to go forward (1 to 30)
float reverse_power = -15; // Power ued to go reverse (-1 to -30)
float turning_ratio = 4.0; // How sharply the vehicle turns. Less is more sharply. (.1 to 10)
string sit_message = "Jump In!"; // Sit message

default
{
    state_entry()
    {
        llSetSitText(sit_message);
        // always add this line to cars!
        llSitTarget(<0.0, 0.0, 1.0>,  ZERO_ROTATION);
        
        // Basic setup
        llSetVehicleType(VEHICLE_TYPE_CAR);
        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.2);
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);
        llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000.0, 2.0, 1000.0> );
        llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10.0, 10.0, 1000.0> );
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.50);
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.50);
    }
    
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key agent = llAvatarOnSitTarget();
            if (agent)
            {
                llSetStatus(STATUS_PHYSICS, TRUE);
                llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
            }
            else
            {
                llStopSound();
                
                llSetStatus(STATUS_PHYSICS, FALSE);
                llReleaseControls();
                
                llResetScript();
            }
        }
        
    }
    
    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT | 
                            CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
        }
    }
    
    control(key id, integer level, integer edge)
    {
        integer reverse = 1;
        vector angular_motor;
        
        //get current speed
        vector vel = llGetVel();
        float speed = llVecMag(vel);

        //car controls
        if (level & CONTROL_FWD)
        {
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0>);
            reverse = 1;
        }
        if (level & CONTROL_BACK)
        {
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <reverse_power,0,0>);
            reverse = -1;
        }

        if (level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
        {
            angular_motor.z -= speed / turning_ratio * reverse;
        }
        
        if (level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
        {
            angular_motor.z += speed / turning_ratio * reverse;
        }

        llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);

    }
}
    

Next, rez a prim and create a new script inside of the prim

Rezzing is the process of creating or making an object appear in Second Life. This can be done by right-clicking on the ground and selecting "Create" or "Build," leading you to the object creation menu. Choose a simple shape for your prim; this will serve as the base of your vehicle.

How do I rez a prim?

Creating a script inside a prim

Test Drive

After you've pasted the script into the prim's inventory, the next step is to try driving. This part is fun because you get to see how your project works. Simply right-click on the prim and choose "Jump In!" Press the arrow keys or "WASD" to move and control your vehicle around the sandbox. This test drive is important because it shows you how your vehicle moves and responds, giving you a chance to see what might need to be fixed or changed. It's a big step in making your drivable car in Second Life, connecting the work you've done with a real experience of driving it.

To prevent your car from tipping over easily, it's crucial to consider the base size of the prim you're using. A narrow base, such as one with a width of only 0.5 meters, can make the vehicle unstable and prone to tipping. To enhance stability, you should increase the size of your prim, particularly its width and length (X and Y dimensions).

Here’s how you can adjust the size to prevent tipping:

  1. Select your prim in edit mode.
  2. In the object size section, find the X (width) and Y (length) dimension settings.
  3. Increase these dimensions to create a broader and longer base. A good starting point is to make the prim at least 2 meters wide and long, but you may need to adjust this based on your specific vehicle design and performance needs.

Experiment with different sizes to find the perfect balance between stability and the aesthetic you want for your vehicle.

Going Faster

Now that you've got the basics of controlling your vehicle, let's make things a bit more exciting by talking about how to adjust how fast your vehicle goes. You'll need to tweak some settings in the script. Inside the script of the car, there are variables. These variables act like dials and switches for different parts of your car, including its speed. By changing these variables, you can make your car go faster or slower, just like adjusting the speed on a real car.

It's a simple process: find the variable in the script that controls speed, and then change the number on the right side of the equal sign before the semicolon. Higher numbers will make your car speed up, while lower numbers will slow it down.

adjust variables script

Remember, changing speeds isn't just about going fast; it's about finding the perfect balance for your vehicle so that it's fun to drive and still easy to control. If your car goes too fast, it might go through walls and get stuck inside. So, take your time to experiment with different settings until you find the speed that feels right for you.

Moving forward, let's delve into how you can share your car with friends and further customize it, making it a unqiue creation in Second Life.

Sharing Your Car with Friends

Sharing your creations can be one of the most rewarding parts of Second Life. If you want your friends to be able to re-share your car and even make their own customizations, you should make your car 'full perm'. Full perm means giving full permissions: 'Copy', 'Modify' and 'Transfer', which allows others not just to use your car but also to modify it or give it to someone else.

full permission menu

However, if you prefer to keep your creation exclusive or for personal use, you can set your car to 'No-Transfer'. This setting allows your friends to use the car but prevents them from passing it on to others. It's a way to share your work while still retaining control over who gets your creation.

no transfer permission menu

To share your car with others, start by taking the car into your inventory. Once it's there, select 'Share' in the right-click menu to send it to your friends.

Customizing Your Car

Enhancing your car with additional objects can add a lot of personalities and make it stand out. You can link other objects to your car to create a unique look or add functionality. Imagine adding neon underglow lights for that cool, night-cruising vibe, or a custom spoiler that screams speed and style. How about a roof rack filled with virtual equipment for the look of an adventurer? These additions can transform your vehicle, giving it a unique look and enhanced functionality. However, when linking objects, it's important to ensure that the car remains the 'root' of the linkset. The root is the main object in a group of linked items, and in most cases, it dictates the properties (like movement) for the whole group.

To ensure your car is the root when linking, always select it last before you link. In Second Life, the last object selected before linking becomes the root. This is crucial because the root object's settings and scripts determine how the linked set behaves. If your car is the root, it will control the movement and functionality of the entire linkset, maintaining its drivability and features.

Linking objects while keeping root

linking objects in sl

By customizing your car and choosing how to share it, you're not just creating a vehicle; you're creating an experience for yourself and others in Second Life. Whether you're fine-tuning it for the perfect drive, adding personal touches, or deciding how it's shared, these steps bring your creative vision to life in the virtual world.

decorated car

© 2025 TOTO Lab.

Tutorial text and media are licensed under CC BY-NC 4.0, and code examples are CC0 by default unless noted otherwise in comments. You may share or adapt for non-commercial use with attribution.

Second Life and SL are trademarks of Linden Research, Inc. TOTO Lab and MIRAI TECH are not affiliated with or sponsored by Linden Research.