Friday, November 23, 2012

Today Progress: Changing cloth for my character

So this is the first attempt to change cloth for my character as in the video


As you can see, i try to make 3 button, shirt, pants, hair,

when i click shirt, i got 5 option to change the shirt

when i click pants, i got another 5 option to change the pants

for the noob that wondering how I accomplish this, below is the stuff that i used

1. OnGui function
- write a new script with OnGui function then add 3 button to the screen, then when pressing any of the button, show a new selectionGrid with 5 item , then you can drag 5 different texture into your selection grid
- when clicking the item on the grid, just change the texture of your character body
-below is sample code


GridValue = GUI.SelectionGrid(Rect(200,200,400,400),GridValue, ShirtGrids, 5); mySkinnedMeshRenderer.materials[8].mainTexture=ShirtGrids[GridValue];



2. Blender UV mapping
- when you create your character on blender, you need to create UV mapping for your character
- you need to mark Seem on your character manually, then select the body part to unwrap it
- you can then export you uvmapping to .png file and draw your shirt or pants on it

any question feel free to ask

No comments:

Post a Comment