MMD Tutorial: How to make a game in unity3D with MMD

 

I just got a small playable application working in unity 3d with mmd models thanks to a point in the right direction from PornulusRift, who makes mmd stuff that works with the oculus rift.
I will explain the steps both for myself (because I will probably forget lol) and for others.
going to run through this quick. it wont have a lot of pretty pictures. but feel free to ask questions.

first I assume you already have the following:
MMD
pmxe
unity3d (for this i used version 4.5.0f6)
made something playable in unity before to be able understand how character controllers, cameras, etc. work in unity3d.

if the anything I post here is not available feel free to mention it. I probably have a saved copy on my computer.

then download this:
https://www.youtube.com/redirect?q=http%3A%2F%2Fstereoarts.jp%2FMMD4Mecanim_Beta_20140805.zip&redir_token=6xH4JACqIS6kIkadMftC9Bq4Vmp8MTQyMTk4MDg5MEAxNDIxODk0NDkw
this converts the pmx to a mecanim compatible fbx asset that can be used in unity. it also can accept multiple animations and stuff it is pretty neat.

then download this next:
https://www.dropbox.com/s/ru8o8dgb2u3w20o/Free_Motion.zip
this is a character controller and camera for mecanim stuff. the default character controller you can import in unity wont work. in fact never use it for this because it conflicts with this controller and will cause none of your scripts to work and instead just give errors.

watch this video and follow the instruction up to the point where you add that single animation:
https://www.youtube.com/watch?v=71jb0TSHq7U

when he adds the MMD4Mecanim go ahead and also add the Free_Motion thing also.
when he adds the one motion on the Animator. add all your games motions in that area.

you can to instead add all the animation your character will use in the game as separate vmd files.
idle, walk,run, and jump pose are the basics. this motion controller has even one for trotting, which is in between walk and full speed run.
all the vmd files and be made and edited to your liking in MMD of course.

add all of the animations and process the model like in the video.

once it is all done click, the model in the asset window. and click the animations button.
this the same area where is the video near the end he is talking how to loop it.

there is a window that says Clips the lists all your animations to added to it.
for each animation click on it and click Clamp Range, and check Loop Time.
once you are done click out somewhere of the box in the render window and it will say there are unsaved stuff. so click to save it.

click you model in the render window, click Physics button and turn physics on to Bullet Physics.
if you don’t like how your physics looks have fun editing it in pmxe and reimporting all this shit bro.

continuing..
From your Projects tab Asset window. FreeMotionTutotrial -> Final_FreeMotion -> Scripts
add the Final_ThirdPersonController to the model. adjust the character controller so it won’t fall through the floor.

set up you animator controller. a guide is here:
http://mecwarriors.com/2013/11/01/humanoid-animation-free-motion-part-3-the-animator-controller/
It is the same guy that made the Free_Motion script.
basically make transitions by right clicking a animation button and pressing create transition. the white arrow line, the under conditions. set it to CharacterState equals whatever like below.

[running] -> [walking] character state = 1
[running] [walking] character state = 1
[idle] [idle] character state = 0
[running] Render Settings to light the colors closer to white to make it brighter.