Skip to content

cuga-rajal/supercar_plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

supercar_plus

Supercar Plus - Open-Source LSL Car Script

version 2.1.3, Oct 29, 2025

Supercar Plus is a free LSL land vehicle (car) script by Cuga Rajal and past contributors, compatible with Opensim and Second Life.

This work is licensed under Creative Commons BY 4.0: https://creativecommons.org/licenses/by/4.0/

For version information and credits please see https://github.com/cuga-rajal/supercar_plus/blob/master/Supercar_Plus_Versions_Credits.txt

For a history on how this script first came about please see https://github.com/cuga-rajal/supercar_plus/blob/master/Supercar_Plus_history. txt


Summary

Supercar Plus is a free LSL land vehicle (car) script compatible with Opensim and Second Life. It supports a wide range of creative options for various car features and the runtime is low-impact on the server. By using a Notecard for settings, vehicles can be updated easily by swapping out the main script without the need to hand-edit any settings. The full project is available at https://github.com/cuga-rajal/supercar_plus.

Many popular features are supported, such as rotating wheels, headlights, horns, driver's animation, passenger seats, multiple gears with reverse, engine sounds, tank tred motions, and much more. A variety of add-on scripts are included with the package along with instructions.

While most people will find everything they need in the Quick Start section, other sections in this Readme have more details.


Whats New

Supercar Version 2.1.3 has a number of enhancements and bug fixes.

  • [Change] Tilt/bank feature now allows configurable side push. This is to accommodate a greater range of vehicle sizes. The config option "bank" [boolean] that became available in V2.1.1 has been changed to "tilt_push" [float] with typical values 5-20. Set to 0 to disable. Disabled by default. If you used the "bank" option introduced in V2.1.1 you will need to update you Config. I don't expect this config option to change again.
  • [Bug Fix] Auto-park location can now be updated while it is in countdown mode.
  • [Bug Fix] Several bug fixes and optimizations
  • [HUD Update] By request, speed now shown in metric and English units; Bug fixes; HUD version now 2.1.
  • [Add-on script update] Multi-sim auto-park script updated, passenger standing will no longer trigger park. "Multi-Sim" has been removed from its name as it now supports single sim auto park. Auto-Park script version is now version 2.4, updated on Oct 29.

Supercar Version 2.2 in the Works

With script memory becoming a concern in SL (getting close to the max 64k) I'm working on a major update for Supercar version 2.2 that will split off some functions into separate scripts.

I am planning to decouple auto-park from the main car script. The separate Auto-Park script included with this package, previously used only for multi-sim auto-parking, can now support single-sim layouts. I removed "Multi-Sim" from its name. The Config setting "auto_park_time" in the main script and Config notecard will be removed in version 2.2.

Also, the reading in of the Config notecard settings will be handled by a separate script. This change helps reduce memory but also introduces the possibility of a future version using dialogs instead of a NC reader to set configs, which could be useful for vehicles distributed without full perms.

To see complete lists of changes for each version, please see the file Supercar_Plus_Versions_Credits.txt.

Upgrading from an earlier version of Supercar Plus

The whole purpose of using the Config notecard to store settings is so that script updates (bug fixes, etc) can be a drop-in replacement, without having to hand-edit any settings. This holds true most of the time.

However, depending on the old version you are upgrading from, some settings may have changed names, been added, or been removed. If you are upgrading, please compare your Config notecard to the one provided in this package, and update it accordingly. Delete any settings no longer used, and add any new ones not previously in the NC.

My general goal is not to make changes to the Config notecard, but a number of recent changes to the main script has required this. I'm hoping not to make any more changes with version 2.2.


Quick Start Instructions:

Any object can be made drivable by attaching it to an invisible scripted prim that lies flat on the ground. In most cases the LI of the object should be kept under 32, but there are tricks to allow higher LI counts to work, described in other sections of these docs.

Rez a cube and set the size to x=4.0, y=2.0, z=0.5. Drop the Supercar script in it and then sit on it to drive. Use your keyboard arrow keys to move. Notice the direction of the prim when it goes forward. This will need to be aligned with the forward facing direction of the vehicle when you link them.

Stand up and move the cube rotation back to x=y=z=0; You can do this from the Edit window, Object tab. The prim will usually drift each time you test drive the car, so it's important to set it back to be square with the region before adding, linking of adjusting prims.

Now, rez your vehicle. If it has a driver's animation, save that to your inventory, then delete everything in the root prim. Drop the driver's animation into the new cube prim. Transfer the vehicle's name to the new cube prim as well.

If the vehicle already has wheel scripts or other assets from a previous car script system, remove those. Align your vehicle square to the sim, pointing the same direction as the forward direction of the cube.

Now move the cube under the vehicle. Resize it to be about the size of the wheelbase. It doesn't have to be exact, you can do it by eye.

Now make a small adjustment to the shape from the Edit window Description tab. For Opensimulator, you can get better stability by switching the base prim shape to Sphere, after resizing it in the previous step. In SL, you can improve the mobility by adding a taper to the prim shape by setting Taper x= -0.15. This will help it go over obstacles much easier.

Now Edit your vehicle, hold down the Shift key, and select the new cube prim last. Link them together with the Link button. You should now be able to drive your car.

The driver's position is likely to be wrong. You can fix this using a Sit Positioner System or with a sit script. Setting the driver's position only needs to be done once. Make sure that you apply the driver's position to the base prim, even if there is a separate visual drivers seat prim. Re-test driving the car after you set the sit position to make sure the driver's position looks correct.

Many other features are detailed below.


Configuration Notecard

The recommended setup is to use a notecard named Config in the same root prim as the main script, which contains configuration settings. A sample is provided with the package. If the Config notecard is present, the script will read settings from the notecard instead of within the script. This is the preferred method because it allows script updates to be dropped into the prim, replacing the old one, without needing to hand-edit any settings.

The file Config.txt provided with this package is a working template for the Config notecard, and provides reasonable values for average-sized cars.


Wheel Rotation

Supercar manages wheel rotation without separate wheel scripts! A Wheel Configurator script provides a one-time dialog-based setup to configure the wheels, without the need to hand-edit any numbers. Once set up, the wheels are managed by the main script.

The script uses the Name and Description fields on the wheel prims to store wheel settings and will overwrite anything already in the Description.

The Wheel Configurator requires the following preparations:

  1. For each wheel prim, remove any wheel moving script in Contents that may have been there.

  2. Set the prim Name to "fwheel" for the front wheels (or any wheels that turn left-right) and "rwheel" for the rear wheels (or any wheels that stay straight)

  3. For each wheel prim, erase anything in the Description field (or it can say "(No Description)").

  4. The Supercar 2 car script should already be placed in the car and tested before using the wheel configurator

Once these steps are completed, the Wheel Configurator script can be dropped into any one wheel. Then click on that wheel to open the dialogs. Follow the instructions in the dialog that appears. The script will delete itself when setup is complete.

During the dialog configuration there is an opportunity to copy the settings to all the wheels. In some cases, this step sets the other wheels correctly and no further steps are needed.

When the Wheel Configurator finishes, check all your wheels. If any of the wheels need to be adjusted, adjust them individually using the Wheel Configurator by dropping the script into the wheel and then touching it to open the dialog.

When you drop in the Wheel Configurator on a wheel that's already configured, it will ask you what you want to change, such as axis, direction of rotation, or speed. You can select the setting that needs to be changed and it will retain the other settings. For example if you just need to change the direction, select that option to adjust it, and then select the defaults on the remaining options to complete the setup for that wheel.

If you adjust a wheel's speed when all the other wheels are already configured, you have the option to copy the setting to other wheels. In this case the script will update the speed on the other wheels but preserve the other wheels' rotation direction. This is so it's easy to fine-tune the wheel speed after initial setup.

reverse turn option

Wheels that turn left and right in addition to rotating have an option to turn left-right in opposite direction of the left-right keys used. This is useful for vehicles that have wheels on rear of the car, which need to turn in the opposite direction as when in front. To enable this on a wheel add "reverse" to the prim name. The prim name may contain multiple words - for example, "fwheel", "smoke" and "reverse" can be in any order.


Passenger Seats

Use a Sit Positioner System to Calibrate Your Passenger Seats

Any prim on the vehicle can be made into a sittable passenger seat. The easiest way to do this is to use a Sit Positioner System, with visual tools to calibrate a sit position for each prim that you want to be sittable. This is the same tool you used to set the driver position.

If a passenger seat doesn't need to trigger animations or other actions

Once you use the Sit Positioner System to set the passenger position, the next step is to decide if you want to have a custom animation play for the passenger, or if their default sit animation is sufficient. If their default sit is sufficient, no further scripting is needed.

If a passenger seat needs to trigger animations or other actions

If you need to play an animation when a passenger is seated, or trigger something else when they sit, such as making a poseball invisible, then a script will need to be placed in that prim to accomplish this. A general-purpose sit script, Sit w/Animation 2.0, is provided for this. This script works with any build, vehicle or not. The script hosts a number of other options. Check the the notes at the top of the script for more details.

The main change with version 2.0 is the addition of a touch menu to adjust the avatar position. Even if you do not have an animation to play, adding this script to the passenger prim will add this touch adjust feature.

Better option for managing a large number of seats

This kit provides another script option for passenger seats that is useful when you have a vehicle with a large number of seats. Instead of using a separate script in each passenger prim, which can cause memory problems for a large vehicle, you can manage all the passenger sits with one script. This can help reduce script memory on the vehicle and help it be more responsive to driving controls. The script "Manage Child Prim Sits 2.1.lsl" can be set up as described in the following section.

Pros and cons of avSitter

If you are already using another sit management system such as avSitter, this is compatible with the Supercar script, however, there can be memory issues when used with a large number of seats. We found that avSitter works well for a couples car up to about 10 singles sits or 5 couples sits. But it has been found to cause script out-of-memory conditions if more than 10 singles sits or more than 5 couples sits are used. particularly at sim crossings and in sims under heavy load. Vehicles with more than 10 singles sits or 5 couples sits should not use avSitter and use a different sit scripting system instead. Working options are included with the kit.

Other options provided by sit script

The most common approach for most vehicles is to use a separate script in each passenger prim. If you are using the provided sit script "Sit w/Animation 2.0", it's default settings simply play an animation in the contents of the same prim. But it has a number of optional features that can also be enabled, for example: adjusting the alpha of the seat prim, playing a hover text when not seated, sending a message to the sitter, etc. Check the comments at the top of the script for details.

Adjusting the sit offset by editing numbers manually

One option is to adjust the sit position by manually editing numbers in the script contents. Some like this option, some don't. If you want to do this, you can use the following steps. Open that script in your prim and set the "sitposition" and "sitrotation" options to the values set by your Sit Positioning System. In most cases those settings will be printed out in local chat and you can transfer them to the script. Once you are sure thos are correct, change the "setoffset" config option to TRUE and then hand-adjust the numerical values "sitposition" and "sitrotation". The script comments explain how to do this in more detail. Note this will override any sit positioning previously set.

Don't add a sit script to the root prim unless you need to

The main car script manages the sits for the driver. A separate sit script is not needed. However the main car script does not provide an option to adjust the driver position when seated. If you want to add a touch dialog to adjust their position after being seated, you can add the general purpose sit script "Sit with Animation 2.0" to the root prim. Before adding this script, make sure "setoffset" config option in the sit script is set to FALSE.


Manage All Child Prim Sits With One Script

The script Manage Child Prim Sits can manage sits for many passenger seats with one single script, greatly reducing the script count on the vehicle and reducing lag. This script now includes a touch dialog to adjust avatar position!

The script supports one animation per seat, and the setup process is fairly easy:

1. Create individual sits in child prims with individual sit scripts and
animations Adjust the sit offsets on each sit prim for specific animations.
2. For each seat prim,
    a) copy the exact name of the animation to the prim Description,
    b) set the prim Name to the word "sit",
    c) Place a copy of the seat's animation into the root prim
    d) then remove the sit script and the animation from the seat prim
3. Place a copy of this script in the root prim

If you use this option, you will also need to use the Driver Animation Controller script to manage the driver's animation.


Engine Sounds

You can use your own car sounds. Just drop them into the root prim and update the Config notecard with your sound names. Alternatively, you can use sound UUIDs in the Config without needing to place sounds in the root prim.

Race car sounds are also provided in the repository. These came with from original iTec Supercar by Shin Ingen and are included here by permission.


Headlights

Headlights can be switched on and off with one of the provided headlight scripts. These scripts will switch lights either at time of driving, or with an optional Supercar HUD. The scripts provide two separate functions -- making the face of the headlight prim bright like a light, and casting a projected light beam on the ground.

To see the headlight beam you will need to enable Advanced Lighting Model in your viewer graphics preferences.

If you are using a headlight beam on one of your prims, you should apply a projector texture to the prim manually before using the script. A sample texture "spotlight" is included for this purpose. Apply this as follows:

Select the prim, go to the Features tab in the Edit window and check the Light checkbox. This will temporarily turn on a point light from the prim. The two boxes to the right of the Light checkbox correspond to color and texture applied to the light. Drag and drop the Spotlight texture to the texture window. This will be applied to the light projector in the prim. Then rotate the prim while watching the projection to point the light beam where you want. When you have finished positioning the prim, you can un-check the Light checkbox. This projection setting will now be used when the light is switched on.

The script "Supercar Headlight 1.80" can be placed in each prim that you want to light up and/or to cast a light projection when car lights are turned on. The script has a few configurations where you can adjust lighting features. There are also settings to enable or disable the face light-up or projector feature on a per-prim basis. It is often necessary to assign some prims displaying as visual headlight and other invisible prims used for casting a projection. Separate prims are often needed because the visual prims may not be facing the right direction for the projection.

With the projector setting disabled but shine setting enabled, the script can be used to light up such things as rear driving lights, visual headlights and running lights. With the projector setting enabled and shine setting disabled, the script can be used to create a headlight projection beam from an invisible prim.

If your car has many lights, The script "Supercar all headlights 1.0" is an alternative method that can control all lights from one script. It requires some extra setup steps and has some limitations, but reduces script count and impact. It requires the visual lights on the car all to have the same settings and the projectors all to have the same settings. Settings can be adjusted from the top section of the script. Setup is as follows:

Name each prim that you want faces to light up as "headlight" and each prim you want to act as a projector as "headbeam". If you want a prim to act as both of these you can name it "headlight headbeam". After naming the prims, drop in the script. If you placed the script before naming the prims, you will need to restart the script for it to take effect.


Horn

The provided horn script makes the horn honk when the horn prim is touched, or when gets a signal from the optional HUD. Place the horn script along with the desired sound asset into the prim that you want to be the horn. Some sample horn sounds are provided.

When you mouse-down on the prim, the horn will play in a continuous loop. When you mouse-up, the horn sound will stop.

If you use the HUD, clicking the horn icon once will play a continuous loop. Click again to stop the horn.


Racecar Effects

There is an option to add wheel smoke, wheel screech sounds, and exhaust pipe flame and smoke to the vehicle, as follows.

All these effects are now controlled by one script, Supercar 2 Racecar Effects. This script must be placed in any prim OTHER THAN THE ROOT PRIM. The selected prim is where the sounds will come from.

There are 2 versions of this script included. The one named "w/pipesmoke" adds continuous smoke from the tailpipes when they are not making flames.

Prims that you want to display smoke when turning left and right, typically the wheels, should have "smoke" included in its name. Wheel prims that are already named "fwheel" or "rwheel" can be named "fwheel smoke" or "rwheel smoke".

Prims that are meant to display exhaust pipes flame effects should be named "flame" or append "flame" to the existing name.

When the script is placed in the vehicle, it checks for child prims for "smoke" or "flame" and remembers those prims. Then the effects are triggered while driving.

The particle texture settings in the script can be the particle asset name or it's UUID. If a asset name is used, a copy of the texture asset MUST be placed in the same prim as the Supercar 2 Racecar Effects script.

The sound settings can also be the asset name or UUID. If sound asset names are used, the sound assets must be placed in the same prim as the Supercar 2 Racecar Effects script.

The script is pre-configured for the texture names and screech sounds provided in the kit. However you can use your own textures or sounds, or UUIDs, and update the settings.

If you change these prim names or assets in Contents after the script is in the car, you will need to reset the script to recognize the changes.

Other settings:

- "burnout_gear" is a specific gear that will play continuous sound and particle
 effects when moving forward or backward. To disable this feature set it to 0.
 Burnout in real life is to heat the tire rubber just before a race to improve
 traction, and to test functioning of the engine at full RPM before a race.

- "turnburnGear" - this gear and above will make smoke & screech sounds when
turning, on the side opposite the turn direction, simulating the expected effects
at high speed

Tailpipe flame effects are displayed for 3 seconds when the car starts up, and while driving in burnout gear.

The textures and sounds provided in this kit came from the original iTec Supercar by Shin Ingen and are included by permission.


HUD

An optional HUD is provided with the package.

To include it with a car, place the HUD in the root prim of the car along with the script Supercar 2 HUD Manager. When the driver sits, they will get a dialog requesting to temp-attach the HUD.

The HUD shows speed, gear selection, and includes controls for changing gears, headlights, horn, and smokescreen. When the driver stands, the HUD automatically un-attaches and deletes. It also deletes itself if not attached after a specified time, to prevent stray objects in the region.

If the headlights, horn, and smokescreen are active when the driver stands, they will be deactivated at that time.

The HUD adds some performance overhead to the region. Don't use the HUD in heavily populated regions or where there is already significant time dilation.


Driver Animation Controller

There are 2 situations when you will need this script.

In most cases a single animation is sufficient for the driver. But there are occasions when you want the driver animation to change depending on if the vehicle is stopped, moving, or going fast. For example, a bicycle, or a hamster wheel. The Supercar 2 Animation Controller add-on script can do this.

The script has instructions in the comments on how to set it up. You configure the script with names of the driver animations, then place copies of the animations into the root prim contents along with the script. The settings anim_idle, anim_fwd and anim_fast correspond to being stopped, moving forward or moving fast.

You will also need to use this script if there are more than one animation in the root prim Contents, and you want the driver to play a specific animation when driving. Set all 3 options to the animation you want to use.


Boarding Ramp Rezzer

The script Supercar 2 Boarding Ramp Rezzer manages the rezzing and removal of a boarding ramp object which is typically used for larger vehicles. This allows avatars to walk up the ramp from ground level up onto the vehicle without having to fly up, adding realism and convenience.

The ramp is deployed when the driver stands and is removed when somebody sits to become driver.

If the click_to_pause config option is used, the ramp is also deployed when the driver puts the vehicle into Park mode and then removed when resuming driving.

If the settings are configured to enable auto-park after a given time, the ramp is automatically removed just before the car moves back to parked location, and then is re-deployed.

The Rez-listen-poof Boarding Ramp script should be placed in the root prim of the boarding ramp.

The Supercar Boarding Ramp script and (scripted) ramp object should be placed in the same prim on the car, but this doesn't have to be the root prim. There are distance limitations on how far from an object an item can be rezzed. If the root prim is too far from the desired ramp location, you can select a prim closer to that location to hold the script and ramp object.

To configure the script, position the vehicle with angle x=y=z=0 to the sim and place the ramp object manually where you would like it to be when deployed.

Check and record the <x,y,z> position of the prim you wish to use for the rezzer script and the <x,y,z> position of the ramp. Calculate the difference between these two positions. In simpler terms this can be done by subtracting the x number from the ramp position from x number of the prim position, and so on. The resulting <x,y,z> number representing the difference between the positions should be added for setting "offset" in the script.

With the car still at placed with angle x=y=z=0, open the Edit window on the ramp and copy it's x,y,z angle into the setting "ramprot" (you can use the "C" button to the right of the Angle section to copy.) These are angles in degrees.

That's it! You can delete the ramp you were using to calculate the settings. Try driving the car and testing the ramp deployment.


Door Opener

Scripts are provided for making a vehicle door/hood/hatch open and close when touching it. Another way to describe this is that a script toggles the prim's local offset and local angle between two positions.

Move your prim to the closed position, then drop in the Display Local Offset script into it's contents. Touch the prim and it's local position and rotation will be displayed in your local chat.

Then move your prim to where you want it to be for the open position. Touch it again and the local position and rotation for the open position will be displayed once again in your local chat.

You can now delete the Display Local Offset script from its contents.

Now open and edit the Toggle Child Prim Position script. Edit a copy in your inventory before placing it in your car!! Copy-paste the position and angle of the Closed position from your local chat to the pos1 and angle1 settings of the script. Copy-paste the position and angle of the Open position from your local chat into pos2 and angle2 settings of the script. Save and close.

MAKE A COPY of your vehicle/object BEFORE dropping in the script!! If something goes wrong, it may be difficult to restore the original offsets. Now that you made a copy, edit the child prim you are working on and drop in the Toggle Child Prim Position script that you just edited. If all goes well it should move back to the closed position and touching it should toggle between the open and closed positions.

You can also add sounds for opening and closing the prim, by changing the sound_open and sound_closed settings. If you use the name of a sound asset, that asset must be placed inside the prim along with the script. If you use the UUID of the sound asset in the settings, then you do not need to add the asset to contents.

The provided script only supports moving a single prim but it could be customized fairly easily to move more than one prim.


Configuration Settings

Settings in the Config notecard template have good default values for average sized cars. A number of settings can be changed to further enhance your vehicle. The meaning of each setting is explained in the notecard. The following sections detail some of these.

auto_park_time

The script has an optional feature to park the car back in it's parking spot at a given time after the driver stands. This feature works only for a single region where it can not be driven to adjacent regions. If there are multiple adjacent regions, this feature should be disabled and you can use the separate Auto-Park script instead, included with the package.

(Note: This auto_park_time setting will be removed in Version 2.2. You can optionally use the Supercar Auto-Park script now for auto-park in a single region. This will provide forward compatibility when upgrading to future version 2.2.)

To use the built-in auto-park feature, set the config option auto_park_time to the number of seconds after the driver stands that the car auto-parks. To disable the single-region feature set auto_park_time to 0. If used, the parking location is set when the script resets, but it can be changed by owner-touching the car when it is not being driven. This brings up a dialog to confirm it's new park location.

The Supercar Auto-Park script has similar settings at the top of the script for delay before parking. If there are no adjacent regions the vehicle can be driven off to, then only the parkDelay setting is required; However, if there are adjacent regions that the vehile may be driven to, some additional setup detailed in the script comments is required. It is designed to work where there is a rectangular grid of A by B regions, all of the same size. The setup requires capturing the names of each of the regions and adding them to the configuration.

Like the single-region feature, the Supercar Auto-Park script sets the parking location when the script resets, but it can be changed by owner-touching the car when it is not being driven. This brings up a dialog to confirm it's new park location.

Whether using the built-in feature or separate script, both options allow you to set or reset the parking spot, and to configure the parking delay. Both options announce in local chat when auto-park countdown begins, and when it is complete. Both options integrate with the Boarding Ramp Rezzer script. If a boarding ramp is being rezzed when parked, that ramp will be removed just before vehicle parking begins, and re-rezzed back at it's parking location.

If you rez a vehicle from Inventory that was previously configured to use auto-park by either method, auto-park will automatically be disabled and you will get a message in local chat reminding you to set the auto-park location. Disabling the feature when a vehicle is first rezzed is required to prevent the vehicle being re-parked to a location from previous use that may no longer be relevant. To reactivate it, simply move the vehicle to it's new parking location, touch it and confirm the dialog.

click_to_pause

This option allows the driver to "Pause" the vehicle without the driver standing. Useful when a vehicle is used as a tour bus making multiple stops. The driver can remain seated and park to let people off and on. The driver can touch the vehicle again and select "Drive" to resume driving.

"Pausing" turns off the engine sound, lights, and deploys any boarding ramp if that option is used. It also sets the child prims' physics types to their original state so that avatars can walk onto the vehicle to find a seat. Without "pausing", child prims remain physics type "None" and avatars trying to walk on it will fall through.

On larger vehicles there may be a few second delay before the physics change ("going solid") is noticed; This is a platform limitation.

"Pausing" the vehicle also has the effect of temporarily disabling the auto-park feature. The driver has the option to stand and exit the vehicle while "paused" and the auto-park will remain temporarily disabled. If anyone resumes driving, the "paused" feature turns off and the next time the driver stands, auto-park will be activated (unless the driver decides to "pause" it again).

This is also useful for a group of people doing a tour with a number of expected stops. "Pausing" can be selected at each stop, to disable auto-park.

click_to_pause is integrated with the boarding ramp script included with this package. Pausing the vehicle triggers the rezzing of a boarding ramp, if used. When the driver resumes driving, the ramp disappears.

If the setting click_to_pause is set to FALSE, nothing happens when the seated driver touches the car.

turnList and speedList

The car speed and turning radius for each gear use presets that work well for an average sized car. If you are using this script on a very small or very big car, it's likely that you will need to override the presets with custom speeds and turning radius that look more realistic.

speedList is a list of integers that are the forward power of the vehicle for the various speeds. If this list setting not blank, it will replace the defaults. If there are fewer entries in the list as the number of gears you are using, the default values will be applied to higher gears.

turnList is a list of floats that represent the turning power for various gears. If this list setting not blank, it will replace the defaults. If there are fewer entries in the list as the number of gears you are using, the default values will be applied to higher gears.

You can check the default values in the Supercar script and then create a list of adjusted values.

Example 1: For a small "Cupcake Car" with a 1.5m footprint, settings that were smaller than the defaults worked best:

turnList = [ 0.5, 1.1, 1.2, 1.2 ];

Example 2: For a large bus holding 20 passengers, settings that were larger than the defaults worked best:

turnList = [ 8, 8, 8, 8 ];

turn_in_place_speed

This gives the option for the car to be able to rotate in place by the driver when not moving forward, using the left-right arrow keys. Value of 0 disables. The number is proportional to how fast it spins.


Link messages

The Supercar Plus script sends llMessageLinked() messages to child prims for various event changes. Some of the add-on scripts in the kit use these messages, for example, headlights turning on when a driver sits and turning off when they stand. Custom scripts can be added to the vehicle that use these link messages.

car_start - when driver first sits to drive
car_stop - when the driver stands
car_park - if auto-park is active, just before the car parks
ForwardSpin - when the forward arrow key is held down
BackwardSpin - when the reverse arrow key is held down
NoSpin - when the forward or reverse arrow key is released
RightTurn - when the right arrow key is pressed down
LeftTurn - when the left arrow key is pressed down
NoTurn - when the left or right arrow key is released

Underlying features to Minimize Lag and Physics Shape Types

When the script resets or is placed in a car, it checks and the physics types of all child prims on the vehicle and stores them in memory so that it can preserve then before and after driving. When the driver sits to drive, all child prims are set to physics type None to minimize lag - physics calculations only need to be made for the one root prim with a simple shape. When the driver stands, the script restores the original physics types of all child prims.

If you change any child prim physics types on the vehicle, make sure you reset the car script before you drive it so that it can refresh it's list of child prim physics types. Otherwise you will lose your changes. There is no way for the script to automatically detect when child prim physics type is changed, so the script reset must be done manually.

The script has an option to selectively keep physics shape type Prim on some child prims during driving, if needed, rather than setting every child prim type None. This can be done by naming the Description field of any prim that you want to remain physical to "prim" and resetting the script. This feature is useful for creating articulating hinges on multi-axle vehicles (experimental).


This is a work in progress. Please notify me of bugs or feature requests.

Cuga Rajal (Second Life and Opensim)

cuga@rajal.org

About

LSL scripts for land vehicles, compatible with Opensim and Second Life

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages