REC Basic Raycast Suspension Addon

The first thing you need to do is build your vehicle as you normally would.

Next it would probably be good to make each wheel so it has no physics.
Do this by selecting the wheels in Edit mode, go to features tab, in the drop down window for Physics Shape Type select "None".

=============== Physics and Raycast:

It is advisable to select your entire vehicle and set its Physics Shape to "None" ... it will throw an error, because the root prim of a linkset cannot be set to "None" but it will still do the rest of your build.

=============== Now Onward ...

After you put your vehicle together, you need to add a prim near each wheel, preferably at the same height of the wheel, and outside the car, about 0.3 meters from the wheel on each side. (Blue On Demo)
These prims can also be set to "None". (Edit mode, go to features tab, in the drop down window for Physics Shape Type "None")
Add the axle skids. (White On Demo)
These mesh skids can be set to "Prim". (Edit mode, go to features tab, in the drop down window for Physics Shape Type "Prim")

Do not encroach them into the tires space too much or it will interfere with your Raycast.

NOTE: Also note, simple large half cylinders set up at each axle location also work very well instead of the provided skids. Just make sure to set them to "Prim" and be sure they do not interfere in the wheel travel area, for 4x4 you would create 2 and for 6x6 you would create 3.

Remember, this is what your vehicle will be riding around on.

Now you have to name each wheel, and each Raycast prim. (Blue on Demo)

You can use the default names from the config notecard, or you can input your own names.

=============== Information to know before setting up the notecard:

You need the wheel size on the wheel and divide it by two. (Half the wheels height) You also need the wheel's local position on the local Z axis.
3 types of information can be gotten in 2 clicks by using the included script in the box "TX RayCast Suspension Advanced Wheel Information Getter".
Dropping this script into one of your wheels and clicking will get you Default Position, Wheel Size and Travel Height.

A note about Move Distance ... the manual way.

You leave the wheel at it's default position, get the local position. Then you move the wheel up to it's max movement up. Get the local position again. Then subtract one number from the other on the Z axis to get your range result
On the wheel range you must ONLY use positive values, so if the result is neg like -0.922, you remove the - (see the script in the box "TX RayCast Suspension Advanced Wheel Information Getter"} or. look in edit window local position Z.

=============== Now it's time to set up the notecard.

Enabled: This option is togglable by 0 for disabled, and 1 for enabled.
This is so you can unlink and link things to the vehicle as needed, set it to 0 when you want to change the linkset. Put it back to 1 when done.

debugMode: This is the debug mode, it is designed to make the installation of the suspension system much less painful. It is toggable via integer 0 or 1. 0 being disabled, and 1 enabled.

WheelRange: This is the travel range of each wheel, the max distance it can go up or down.

SixBySix: This enables the middle axle to be used on vehicles six wheels. Think like semi trucks with a working suspension.

WheelDrop: This is the max distance the wheels will drop if the car is lifted off the ground.

RayRange: The max distance that the raycast ray for each wheel will travel. Probably best to keep it a little higher than the half height of the wheel if the raycast prims are at the center of each wheel. size: This is the Z height of the wheel divided by 2. So if the wheel is 2 meters high, the size would be 1

DefaultWheelHeight: This is the default deadzone of the wheel, it's based on local position. rate: This is the rate of the timer for the raycast.

Generally lower is more responsive while higher causes less lag on the server.

The last settings on the notecard are for the names of each wheel and raycast prim. I think these are pretty self explanatory.

After you set up the configs, put the SuspensionConfig notecard into the vehicle.

Once you've done that, put the Suspension System script in root after. If your wheel goes too far up while the vehicle is sitting on the ground, then adjust the wheel range in the notecard as needed.

=============== Conclusion

A good way to test a wheel is to put a prim under it which moves up and down on it's own. Obviously, once assembly is finished, you can hide the blue and white prims via alpha or transparency. We have tried very hard to not leave anything out, we realize this is a somewhat complex system to set up, but on the plus side it should dramatically raise the resale value of your builds. 
12 of 50 people found this helpful.   

Powered by LiveZilla Helpdesk