Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.