Skip to content
Learn MikuMikuDance – MMD Tutorials – Free 3D Animation Software

Learn MikuMikuDance – MMD Tutorials – Free 3D Animation Software

Download Free Animation Software – Let's Learn How to Do Everything!

  • Step-by-Step MMD instructions
  • DOWNLOADS
  • Troubleshoot, Fix MMD
  • Site Contents
  • Reggie Replies Q&A
  • Homework!
  • What IS MMD?
    • Download MikuMikuDance Newest Latest Version of MMD
  • “HOW TO”
    • Raycast RAY-MMD Effect Tutorials
  • BONUS PAGES
    • Why convert PMD models to PMX?
  • HALL of CHAMPIONS
  • Tutorial Categories
  • About
    • Privacy Policy
  • Toggle search form
  • Sweet Home 3D Creates Custom MMD Interiors as .x or .pmd MMD Tutorials
  • ReSize SketchUp Models for MikuMikuDance Google SketchUp and MMD
  • Use Professional Tricks to Make MMD Animating Faster and Easier Random Thoughts & Visions
  • Video Dojo Expo 1 Champion
    Video Dojo Expo 1 Winner: EmberAce216 EmberAce216
  • Ghost Effect for MME
    How to Use the Ghost Effect for MME! ARIZONA
  • Making it Personal MMD MMD Basics
  • ZERO-GRAVITY Day on the beach in MMD!. Use Gravity Settings and Noize to make winds blow.
    Using the Gravity Settings in MikuMikuDance ARIZONA
  • Hand Clap free download MMD motion file
    ureshiiiiii “HAND CLAP” Free Motion & WAV Download – Awesome! "the making of" my video

Play games within MMD using MMD as a Game Engine!

Posted on November 8, 2016July 7, 2024 By Trackdancer 8 Comments on Play games within MMD using MMD as a Game Engine!

A feature article on LearnMMD by Trackdancer2015!

Play Games within MMD!

The MMD physics engine is really quite remarkable; after all, it was written by a professor working for Tokyo University. In this article we’re going to show you exactly how good this physics engine is by showing you how to make a vocaloid actually throw a ball.

USING MMD AS A GAME ENGINE we will
put a ball in your model’s hand…
…and make your model THROW it!

We will also show you how you can use this knowledge to develop games that you can play with your favorite Vocaloid model just using MMD!

IA Rocks [UNOFFICIAL] tells us about the MMD Physics Engine... how to make a bouncing ball and how to THROW it!

This will be a long article, but if you are patient and work through it all with us, you will also learn some really advanced techniques using both MMD and the PMD editor.

Many PC and dedicated gaming platform 3D RPGs have some sort of physics engine similar to one that comes with MMD, but the one that comes with MMD is good enough to use it to play almost any game that requires some sort of physics calculation.

Japanese MMDers for example have used it to make it possible for Miku to play billiards with scientific accuracy, but we’re not going to go that far with this article. Instead, we will show you how to make a vocaloid throw a ball and make a little game out of that.

Get the pinkBall.pmx model…

Download the ZIP of files created for this project.Download the LearnMMD_Throw_A_Ball.ZIP support materials. Inside that folder you will find motion files and the pinkBall.pmd model… an enhanced physics dynamic model: a bouncing ball. (Learn how to make your OWN bouncing ball!)

The pinkBall is not a “normal” model…

When you load the pinkBall, you will find that you cannot “do” anything with it; you cannot move its center bone. This is a dynamic model. The reason why you cannot pick up the ball with the center bone is because it is not weighted to it plus the fact that the ball bone to which the ball is weighted is under the control of MMD’s physics engine. Bones under the physics engine’s control cannot be user selected normally which is why they are normally hidden from the user in the MMD display.

But what’s the good of a ball that you can’t even control?

Actually, the ball can be totally controlled by a vocaloid! In actual fact the vocaloid can not only pick up the ball, but drop it. And if they can drop it, that means they can throw the ball and in a scientifically accurate manner if you program her correctly. But let’s start by getting the vocaloid to pick up the ball. To do this we will need IA’s help. So let’s load her next.

The model needs a Hand Attachment bone…

We will be using my version of IA Rocks [UNOFFICIAL] to illustrate and demonstrate the points discussed in this article. However, if you want to use a different model, that’s fine too as what we will be discussing here will work with any MMD model, but it will need a hand attachment bone. Most Tda style models will have one of these bones and they’re used to make it easy for an MMD model to hold things in their hands. This bone can also be added to a model without one of these bones using the PMD semi-standard bone plugin.

Now if you loaded the ball first, the moment you load IA the ball starts moving. Why? Basically because she kicked it out of her way so that she could occupy the same space. Physics in MMD is primarily used for collision detection and what you just saw happen is a graphic demonstration of this process.

mmd_ia_ball_collide

So how do we get IA to pick up the ball?

Start by making a pose of IA holding the ball. You can make your own pose or use the one we provided (IA_holding_ball_pose.vpd) in Download the ZIP of files created for this project.the support materials download package. But the ball is still wandering around aimlessly somewhere around her feet so we’ll get her to pick it up. To do this do the following.

  1. Make the ball the focus model and make sure that you’re at frame 0 in the frames display.
  2. Expand the ballcontrol category so that you can select the ball bone. Click on the name to select the bone. The name will be highlighted once it is selected. With physics turned on, this is the only way to select one of these types of bones.
  3. Next turn off the physics control on the bone manipulation panel then click register. The “X” symbol next to the ball bone should change to a diamond symbol. Once this happens the bone will be user selectable, but we won’t need to manually move the ball into IA’s hands. There’s a much easier way and it is also one of the methods used to make a vocaloid model hold an object like a microphone in MMD.

Click on the OP button to open up the Outside Parent Settings window. Use the following settings.

subject bone: ball
target model: IA Rocks
target bone: attach_L (on Tda models this bone is usually labeled dummy_L)

Click on the OP register button.

Now normally for a static model like a microphone, the model will automatically pop into the model’s hand but the ball is a dynamic model so we need to do one more step.

Under the main MMD graphical GUI next to the “To camera” button are six fields pertaining to the XYZ coords and angle of the bone. We need to zero these out since the ball probably wandered off somewhere by itself when it’s physics was under the program’s control. To zero these values out just click on the “X”, “Y” and “Z” buttons next to each field. Then click on the register button in the bone manipulation panel to lock the ball bone’s position. The ball should now be in IA’s hands. If you used our pose data you need to do nothing else. If you used your own pose data or another model then proceed to the next step.

You will probably need to sit the ball properly in your model’s hand. To do this simply adjust the balls position in the hand using the vocaloid model’s hand attachment bone. Don’t move the ball by using the ball bone.

mmd_holding-the-ball_tb

So how do we get IA to drop the ball?

Now that you know how to hold an object in their hands, we will show you how to make them drop the object.

Advance a couple of frames, arbitrarily we will use frame 5, then open up the ball’s Outside Parent Settings panel again.

Change the settings to:

subject bone: ball
target model: non
target bone: (auto populated with dashes)

Click on the OP register button.

The section underneath (subject bone relative place (auto calculated)) isn’t needed with the ball as it is a dynamic model but with a static object model once it is released by the model holding it you will want to click on the “frame register” button to lock it’s position to where it was released otherwise it will jump back to it’s default load position which is probably what you don’t want to see happen. So if you ever wondered what this function is, now you know.

mmd_dropping-the-ball_tb

At this point (frame 5) IA has released the ball and it will go straight down and bounce a couple of times. Tab back to frame 4 using the left cursor key and the ball goes back into IA’s hands. Tab forward again to frame 5 using the right cursor key and the ball drops again. See how it all works?

If you got this far and everything is working as noted here, you’re already way ahead of most MMDers as you are now able to dynamically interact with your vocaloid character. Now isn’t that something?

But we can go further than that. We can teach your model to throw the ball after all, what’s the fun of just dropping it?

Programming a vocaloid to throw a ball

Actually, you can get really sophisticated in how you program “a vocaloid throws the ball” but we will keep things simple in this article to demonstrate the basic principles by just having IA fling the ball. For this we will need motion data and the neat thing about this is that what her body does actually affects how the ball behaves once it is released. So for example an overhand throw will affect the balls trajectory in a manner totally differently from an underhand lob.

But for this article we will just adapt the pose data we just created to have IA fling the ball. You can create your own motion data but for now it will be easier to use the data that we provided (IA_ball_throwing_demo_motion.vmd). The data is 110 frames long and is intended to run for about 250 frames so load this data onto your model and set up your play functions accordingly. Some of the motion is just filler, the most important section is what happens from frame 0 to frame 30 – especially frame 30 when the ball is released.

So the first order of business once the motion data is loaded onto your vocaloid model is to flip back over to the ball model and drag all the recorded data at frame 5 (from what we did above) over to frame 30 as we want to the ball to be released at this point in time. Use the cursor to play the motion and check that the ball is in the model’s hands between frames 0-29 and released at frame 30. If this is correct, then hit the play button and see IA fling that ball!

OK so let’s throw that ball!

But… she’s throwing like, well, a girl, right? Well not to be sexist but the ball didn’t go far did it? And you’re probably thinking that you just wasted a good portion of your time but before you start sending me nasty notes, let me ask you the same question I asked above again: did you stay awake in physics class?

Click the image to see instructions for throwing the ball!

The reason why the ball didn’t go far is because of a simple law of vectors:

Isaac Newton’s Second Law of Motion

In concise terms this law states that the net force on an object is equal to the mass of the object multiplied by the acceleration of the object.

The ball has a mass – we gave this to the ball when we built it.

The ball also has acceleration – we know this because when IA threw the ball it didn’t go straight down.

So the reason why the ball didn’t go far is due to lack of force, but how do you create force in MMD?

The answer is actually very simple:

Force=mass x acceleration.

Therefore, all we need to do is accelerate IA’s movements and in so doing you will see exactly how good the MMD physics engine really is!

To accelerate (or decelerate) motion in MMD you use interpolation curves and/or modify the number of frames required to perform a set movement. But for our purposes we only need to accelerate the motion at frame 30, so go to the frames display and do the following:

  1. Select all the bones that are registered at frame 30 – just drag select them with the mouse.
  2. With these bones selected change the interpolation curve to something like in the diagram shown in the illustration below.

interpolation_curve

Now play back the motion.

Quite a difference isn’t it? If you did it correctly IA would have thrown the ball quite some distance.

MMD as a physics laboratory

Try different types of shapes for the interpolation curve and see what happens to the ball when it is thrown. You’ll find that for any given curve the results are fairly consistent in terms of distance and direction but sometimes the ball behaves quirky. One way to avoid this is to allow the full sequence to play through and for the physics engine to reset itself before hitting the play button again.

But you won’t get the exact same results each time due to other factors such as some degree of ambient noise built into the engine and factors like what else your PC is doing at the same time.

The next experiment is to open up the gravity settings panel again and trigger the noise function and see what happens now. Then try to change the acceleration (due to gravity) setting. This is by default set at sea level (9.80). A smaller figure represents the value of this variable at higher altitudes and it can have considerable effects on far the ball can be thrown.

But just as importantly is exactly what positions and angles IA’s bones are at in frame 30. Experiment by tweaking the angles and positions of those bones and see the difference. I made IA throw the ball slightly upwards with this motion and to help build force by pulling her arm back but if you change these the ball’s behavior will be totally different because it will change the angle at which the ball is released and the force with which it can be thrown.

Everything IA does with the ball with this system is scientifically accurate!

OK so let’s make this into a game!

Right then, when you’ve got the hang of how all this works let’s make this into a simple game. In the download package is a simple physics enabled “basket”. This will catch the ball if you can get IA to throw the ball into it.

So that’s the object of the game: Throw the ball into the basket.

Have fun playing a game within MMD!

To play, place the basket anywhere you like and simply have IA throw the ball into the basket. Try different interpolation curves, or tweak her motion to make this happen. You can also reposition and to a degree aim IA by moving her using her mother bone.

For a greater challenge, add noise or put the basket further away and mess with the acceleration variable to get the distance needed to reach the basket.

BTW, see what happens to the ball after it is thrown if you turn off the floor physics…

For even more advanced play, create your own motion or tweak the physics properties of the ball itself. Incidentally, the ball can also be kicked if the model kicking it has physics for the feet and vocaloids can really kick balls quite hard. You’ll be surprised how good the MMD physics engine really is!

Miku does it! Have fun playing a game within MMD!

And so now not only can your vocaloids sing, dance, make videos and pictures in MMD, they can even now play games with you and remember, you read about this first on LearnMMD.com!

Have fun and thanks for reading!

dl_here

CREDITS:

MMD 9.26
PMD 0.1.3.9
SketchUp Make 2014
Photoshop 7
DivX Codec

IA Rocks [UNOFFICIAL] – Mqdl/Trackdancer
IA (C) The First Place Co., Ltd. (Japan)

Miku Append – Tda
Miku Hatsune (C) Crypton Future Media, Inc. (Japan)


– SEE BELOW for MORE MMD TUTORIALS…


— — —


– _ — –


Visit the LearnMMD.com Homepage! Plenty of Mikumikudance instruction and info!

More MMD Tutorials...

Reader asks how to create MMD artwork... stuff like posing, camerawork?

A reader asks... Is there a tutorial on how to create MMD artwork, like those you ...read more

Learn MikuMikuDance in Small Steps! New LearnMMD Video Series

Learn MikuMikuDance in Small Steps. Where can I find easy-to-follow MMD instructions on YouTube? How ...read more

Apply Multiple Effects on an Entire MMD Model Using M4Layer Effect

How can I apply multiple effects to an MMD model? Can I use more than ...read more

MMD Plugin Manager... I Found a Treasure!

What sorts of MMD Plugins are there? MMD Plugin Manager? MMD Plugins. Plugin MMD. More ...read more

2023: Hatsune Miku is 16 Years Old by design and in reality!

Finally, in 2023, Hatsune Miku is 16 years old! When did Miku make her first ...read more

SEARCH LearnMMD.com... it's Easy!

Search LearnMMD.com to find your answers! With the posting of this article, LearnMMD.com has 758 tutorials ...read more

Creating Motions, hand attachment bone, Making Smooth Motions, MMD Tutorials, Trackdancer2015

Post navigation

Previous Post: Zazi’s Guide To Atmosphere in an MMD animation
Next Post: No MikuMikuDance MMD in India… can it be?

Related Posts

  • Animate MMD ballet pirouette motion Creating Motions
  • Easily Create Walk-in-Place Motion in MMD Animation Shortcuts
  • Make a Smooth Walking Motion in MikuMikuDance Make a Smooth Walking Motion
  • See my new YouTube MMD video “She’s So Hot!” Making Soundtracks
  • New LearnMMD Stage Instructions just posted! MMD Tutorials
  • Click to see the new Getting Started with MMD Video on YouTube!
    Getting Started with MMD Video on YouTube! MMD Basics

More Related Articles

Troubleshooting MMD errors and setting up d3dx9_32.dll error
Make Smooth Motions using Multiple Keyframes Animation Shortcuts
How do I use MikuMikuDance Make A Music Video with MMD Intro to MikuMikuDance
Smooth camera moves and soft focus make for smooth scene transitions in MMD 7.39 . LearnMMD.com Smooth Scene Transitions featured in new MMD Departures video "the making of" my video
The MMD Pity Partry motion is free to download! MiyukiOhayashi’s Pity Party motion download includes WAV "the making of" my video
Speech Synthesizer gives MMD Models a voice! Making Soundtracks

Comments (8) on “Play games within MMD using MMD as a Game Engine!”

  1. jazmine redner shela rose says:
    August 17, 2020 at 10:37 am

    i really want to make dr.shy,jess,jacks,and mike i made them in gacha life

    Reply
  2. Littlewolfie says:
    December 13, 2019 at 3:29 pm

    I want to play but I cant

    Reply
    1. Reggie_Dentmore says:
      December 14, 2019 at 7:09 am

      So sad. If you have more to say, maybe we can help you.

      Reply
  3. Darketernal says:
    May 6, 2019 at 2:29 am

    If people have trouble like me with dropping the ball in frame 5, don’t forget to turn ‘physics on’ again for the ball in frame 5 and register this by pressing enter. And when you press play, make sure you say ‘play frame 0 to about 120’ , otherwise the playback might stop abruptly.

    Reply
  4. jayden says:
    February 16, 2019 at 12:11 pm

    hi i would like to make the toons i like to make a lot of things and its hard work i started to do this scene i was 8 years old
    it would be fun for people all around to see this

    Reply
    1. Reggie_Dentmore says:
      February 17, 2019 at 8:14 am

      Go for it… have fun!

      Reply
  5. Mahlazer says:
    November 29, 2016 at 8:38 am

    This is a very nice article. Thank you for making it ^^

    Reply
    1. desti y says:
      November 10, 2017 at 5:10 am

      Thank you thank you for making this love it

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Download the latest version of MikuMikuDance!
See the MMD Step-by-Step instructions page!
Learn how to make your own MMD motions!
LearnMMD.com
  • Painted Table Accessory Download Available Now Downloading New Models
  • ‘PROJECT: MikuMiku Movie!’ part 01: prepare the first scene! Fia Phoenix
  • Make a Smooth Walking Motion in MikuMikuDance Make a Smooth Walking Motion
  • Make an MMD Music Video Bo Beep Bo Beep! "the making of" my video
  • Applause for Miku!
    MikuMikuDance turns Six. ARIZONA
  • Using the Beamman’s Digital Ripple Effect Digital Ripple
  • Download Jomomonogm's Snow Miku 2019
    Download Jomomonogm’s Snow Miku 2019 for MMD, a most unusual model! "the making of" my video
  • Knock-out the Background as you Render to Picture in MMD Add Background Pictures and AVI

Copyright © 2022 Learn MikuMikuDance – MMD Tutorials – Free 3D Animation Software and Instructions..

Powered by PressBook Premium theme

Go to mobile version