Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script for saving PropRotating Traffic Light Shader params in props.
// Prop Rotating Script (Traffic Light Shader - Railway Crossing Barriers)
// Control rotation axis and pivot.
// Run in asset editor.
// Prop Rotating Params Mod is not required for using the scripts and saving the asset.
// It's only needed to load the data in-game.
// Rotating parts must be vertex painted black! The rest reimains white.
// Google how to do vertex color painting in your 3d software of choice!
var axis = new Vector3(0.0f, 0.0f, 1.0f); // Set to 1 to choose rotation axis.
var pivot = new Vector3(0.0f, 1.1f, 0.0f); // Pivot point - center of rotation.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
var shader = Shader.Find("Custom/Props/Prop/TrafficLight");
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
var vec = new Vector4(axis.x, axis.y, axis.z, 10.0f); asset.m_material.SetVector("_RollParams0", vec);
var vec2 = new Vector4(pivot.x, pivot.y, pivot.z, 1.0f); asset.m_material.SetVector("_RollLocation0", vec2);"PropTrafficLight "+axis.x.ToString("R")+" "+axis.y.ToString("R")+" "+axis.z.ToString("R")+" "+"10"+" "+pivot.x.ToString("R")+" "+pivot.y.ToString("R")+" "+pivot.z.ToString("R")+" ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.