Skip to content

Instantly share code, notes, and snippets.

@ronyx69
Created March 18, 2019 02:03
Show Gist options
  • Save ronyx69/b2a53cce3a02b22ab4f425b95bf0825a to your computer and use it in GitHub Desktop.
Save ronyx69/b2a53cce3a02b22ab4f425b95bf0825a to your computer and use it in GitHub Desktop.
Copy vertex paint from prop to vehicle, set tire parameters.
// Copy vertex paint from prop to vehicle and set tire parameters.
var asset2 = PrefabCollection<PropInfo>.FindLoaded("filename.Asset Name_Data"); // CHANGE TO PROP NAME
Vector4[] tyres = new Vector4[] { // Tire parameter vectors (X, Y, Z, diameter), add/remove lines if necessary.
new Vector4(-0.739f, 0.328f, 1.421f, 0.328f),
new Vector4(0.739f, 0.328f, 1.421f, 0.328f),
new Vector4(-0.739f, 0.331f, -1.93f, 0.331f),
new Vector4(0.739f, 0.331f, -1.93f, 0.331f)
};
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as VehicleInfo;
Color[] colors = new Color[asset2.m_mesh.vertices.Length];
for (int i = 0; i < asset2.m_mesh.vertices.Length; i++) colors[i] = asset2.m_mesh.colors[i];
asset.m_mesh.colors = colors; asset.m_generatedInfo.m_tyres = tyres;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment