Last active
April 12, 2017 22:08
-
-
Save ronyx69/0555ac4160b704a6bcd25a2082584bce to your computer and use it in GitHub Desktop.
A first draft at converting a vehicle to a prop ingame.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vehicle = PrefabCollection<VehicleInfo>.FindLoaded("Sedan"); //get the vehicle | |
var prop = PrefabCollection<PropInfo>.FindLoaded("Cargo container"); //get the prop | |
prop.m_mesh=vehicle.m_mesh; //apply vehicle mesh to the prop | |
prop.m_material.SetTexture("_MainTex", vehicle.m_material.GetTexture("_MainTex")); //apply vehicle diffuse to prop | |
prop.m_material.SetTexture("_XYSMap", vehicle.m_material.GetTexture("_XYSMap")); //apply vehicle XYS to prop | |
Texture2D aci; aci = new Texture2D(1, 1); //make new empty texture | |
aci = vehicle.m_material.GetTexture("_ACIMap"); //WRONG!!! ACI should be made unique/instantiated!? idk | |
//pixel loop to change all illumination pixels to white (no illumination) | |
//won't work because non-readable texture, probably will work with custom assets | |
//but still the ACI texture will change on the vehicle as well so... | |
//the aci on the prop needs to become unique/instantiated or whatever it's called, idk how to do it | |
Color px; | |
for (int i = 0; i < aci.width; i++) | |
{ | |
for (int j = 0; j < aci.height; j++) | |
{ | |
px=aci.GetPixel(i, j); | |
px.b=1; | |
aci.SetPixel(i, j, px); | |
} | |
} | |
aci.Apply(); | |
prop.m_material.SetTexture("_ACIMap", aci); //should apply the new ACI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment