Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Prop Rotating Script
- // Control rotation axis, pivot and speed.
- // Run in asset editor and see effects in real time.
- // 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.
- // Animated faces must be vertex painted black! The rest reimains white.
- // Google how to do vertex color painting in your 3d software of choice!
- // The LODs are not rotating, they are like regular props.
- var axis = new Vector3(1.0f, 0.0f, 0.0f); // Set to 1 to choose rotation axis.
- var pivot = new Vector3(0.0f, 5.0f, 0.0f); // Pivot point - center of rotation.
- var speed = 60.0f; // rotations per minute
- var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
- asset.m_lodHasDifferentShader=true;
- var shader = Shader.Find("Custom/Props/Prop/Rotating");
- if(asset.m_material != null) asset.m_material.shader = shader;
- shader = Shader.Find("Custom/Props/Prop/Default");
- if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
- var vec = new Vector4(axis.x, axis.y, axis.z, speed); asset.m_rollParams[0]=vec;
- var vec2 = new Vector4(pivot.x, pivot.y, pivot.z, 1.0f); asset.m_rollLocation[0]=vec2;
- asset.m_mesh.name="PropRotating "+axis.x.ToString("R")+" "+axis.y.ToString("R")+" "+axis.z.ToString("R")+" "+speed.ToString("R")+" "+pivot.x.ToString("R")+" "+pivot.y.ToString("R")+" "+pivot.z.ToString("R")+" ";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement