meta data for this page

Vehicles: Snowcat blade

In season 2, the snowcat blade technics have been moved to the script file. This tutorial is mainly aimed at preexisting vehicles from season 1 that are to be converted for season 2, but it can also be used for new vehicles.

Removing the Snow Blade component

First off, you will want to remove the “Snow Blade” component from the “left” gameobjects that can be found under the blade and its wings

To delete the components, right click on their titles and select “Remove Component”.

Moving the points forward

Next up you should move all of the points forward to avoid the snow clipping into the blade when driving. I recommend to move it 0.65 units forward on the Z axis, from the season 1 position. To do this you can simply select the point, then click on the Z axis box and write +0.65 behind the current number and it will automatically add them together. Repeat for all points.

That is everything you have to do in Unity itself. Now we will move over to the script file.

Adding the script to the .lua file

Open up your vehicle script file and navigate to the vehicleScripts table. Inside the table, add SnowBlade, to the bottom of the list like in the picture below.

Once you have done this, copy the script below and paste it over to your script file, after the end of the vehicleScripts table

	snowBlade = {
		-- As it is right now, the snowBlade script needs exactly six points to work properly: 2 points each at the left bladeflap,
		-- the middle flap and the right bladeflap. Naming begins with P1 at the outer left bladeflap and stops with P6 at the outer right bladeflap.
		-- It is important to go from left to right (looking in forward direction of vehicle). The points are placed as empties at the bottom of the blade.
 
		-- opening angle of the snow field
		bladeOpeningAngle 		= -20,
		-- distance between the middle pair of points, P3 and P4, gets multiplied with bladeRangeCoefficient and so we get 
		-- the max distance where snow in front the blade is effected
		bladeRangeCoefficient 	= 1.5,
		-- snowHillCoefficient determines how fast the snowhill builds up and how wide it gets
		snowHillCoefficient 	= 0.1,
		-- how much snow the blade loses when going over ground without snow
		lossValue				= 2,
		-- max height of snow in front of blade
		maxPlowHeight			= 220,
		-- snow can be removed completely or not (not implemented yet though)
		canRemoveSnowCompletely = false,
 
 
		leftBladeLeft 	 			= "leftBladeLeft_Index",
		leftBladeRight 	 			= "leftBladeRight_Index",
		middleBladeLeft  			= "middleBladeLeft_Index",
		middleBladeRight 			= "middleBladeRight_Index",
		rightBladeLeft 	 			= "rightBladeLeft_Index",
		rightBladeRight  			= "rightBladeRight_Index",
 
	},

It should look something like this in your script file:

Replace the 6 indexes at the bottom with your paths to the “left” and “right” gameobjects on the blade.

For the rest of the variables, you can tweak those to your liking, but the standard values work well.

That's it, now you have a functional blade for season 2!