Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. // Prop Rotating Script
  2. // Control rotation axis, pivot and speed.
  3.  
  4. // Run in asset editor and see effects in real time.
  5.  
  6. // Prop Rotating Params Mod is not required for using the scripts and saving the asset.
  7. // It's only needed to load the data in-game.
  8.  
  9. // Animated faces must be vertex painted black! The rest reimains white.
  10. // Google how to do vertex color painting in your 3d software of choice!
  11.  
  12. // The LODs are not rotating, they are like regular props.
  13.  
  14. var axis = new Vector3(1.0f, 0.0f, 0.0f); // Set to 1 to choose rotation axis.
  15. var pivot = new Vector3(0.0f, 5.0f, 0.0f); // Pivot point - center of rotation.
  16. var speed = 60.0f; // rotations per minute
  17.  
  18. var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
  19. asset.m_lodHasDifferentShader=true;
  20. var shader = Shader.Find("Custom/Props/Prop/Rotating");
  21. if(asset.m_material != null) asset.m_material.shader = shader;
  22. shader = Shader.Find("Custom/Props/Prop/Default");
  23. if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
  24. var vec = new Vector4(axis.x, axis.y, axis.z, speed); asset.m_rollParams[0]=vec;
  25. var vec2 = new Vector4(pivot.x, pivot.y, pivot.z, 1.0f); asset.m_rollLocation[0]=vec2;
  26. 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