Friday, July 5, 2013

Doraemon into Unity3D !

Do you know Doraemon ?

If no, and if you like 2D cartoon animation, you must discover this series, knowing that you can find a lot of resources on Youtube....

If yes, maybe you will be happy to now that I did a little demo playable online here !

Click in the game below, and then control Doraemon using LEFT/RIGHT arrows and SPACE of your keyboard:

Content displayed within Unity Web Player


So what are the features of this demo ?

First, I used Unity3D (free version). If you don't know what is Unity3D, you can imagine it as a mix between Flash and 3D studio Max. Because the software is fully 3D oriented, you could ask me the question : why use it to do 2D content ??? Then I would answer that Unity is so powerful ! Fully hardware accelerated, can target a lot of plateforms (Win, Mac, web, Android...) and is delivered with the sophisticated NVIDIA PhysiX engine.
So the challenge here was to build a 2D engine from a 3D engine, and I must admit that with some perseverance, the result is quite good ! But it was not an easy task to keep control of the engine while contraigning it in 2D and keeping the essential liveliness for a 2D game.

Second, I built my own graphicals assets. For the Doraemon animations, I picked some episodes and captured some interesting animation sequences (idle, run, jump and fall). Then I redrawn each images of the sequences into Flash, exporting them using the "Generate sprite sheet" tool. Finally, I wrote my own C# classes in order to replay my Flash animations into Unity.

Doraemon running sprite sheet

I hope you liked this demo. If you are a Unity user and you would like to build your 2D engine like me (without 3rd party plugin) maybe I can give you some advices:
  • don't use the "Character controller" component ; it seems not relevant for a 2D game (because of the capsule collider)
  • instead, use the combination of the "Box collider" and "Rigidbody" components for your character
  • then, avoid any generated friction and bouciness between your character and other objects in the world
  • code your character to move appropriately using directly the "velocity" property of your "Rigidbody" component
  • to detect if your character has his feet on the floor, you must use the "OnCollisionStay" method. By computing the dot product between the normal contacts and the (0, 1, 0) vector, you can know if one contact occurs below the character

4 comments:

  1. I want to download your demo project. can you give me? and what is "flash"? A software? Where to download it????

    ReplyDelete
  2. The software I used for the animation is Adobe Flash CS6:
    http://www.adobe.com/mena_en/products/flash.html

    ReplyDelete
  3. Cute demo, nice work.
    But the swing at the end of level interacts counter-intuitively: when moving left on it, I'd expect the swing to go right: we're exerting a force to the right on the swing so that we can move to the left. Was this intentional? Or a by-product from using physics in Unity?

    ReplyDelete