Experimenting with Unity: Part Two

Posted on 10th February 2013  |   Catagories: 3D, Illustration, Scripting, Unity
11 comments

player_touch

This is the second in an ongoing series of Unity related posts. Click here to read part one and try the day/night demo.

The next thing I set out to develop in Unity was a simple, touch controller ‘avatar’ that could move with a natural, fluid motion – the idea being that this simple interaction would be rewarding in it’s own right. I was hugely inspired by Journey for PS3, and how the players movements made up a large part of the overall experience – simply travelling through the world became one of the biggest rewards for playing the game.

As before, the demo below uses the Unity Web Player. To interact, click and drag anywhere inside the play area.

The behaviour of the trailing ‘legs’ proved to be the most difficult and interesting part of the process. I initially assumed Unity’s built in physics engine could take care this, but unfortunately the high number of joint constraints and the relatively ‘vague’ nature of the engine resulted in some pretty erratic behaviour. Instead, I opted for writing a custom script based on this brilliant bit of code. In combination with Unity’s line renderer, it gave me the perfect result with surprisingly little overhead.

A few extra notes:

  • Clicking on the play area actually updates the position of an invisible ‘pointer’ object. The player, in turn, is continuously moving towards the pointer, at a speed proportional to the distance between them.
  • The length of the legs can be adjusted during run time, providing a neat visual indicator for various attributes such as the players health or progression.

Thanks for reading! In the next post, I’ll take a look at closer the art style, graphics and iOS optimisation.

  • http://twitter.com/stalkbrandon Brandon V. Fletcher

    I havent gotten into Unity yet (Its installed on my computer), but how are you getting the 2D look in your games? I know there is a 2D plug in the asset store. Are you using that?

    • http://www.miletbaker.com/ Jon Milet Baker

      In addition to what @5467e808ac0e3e9a4b7a5c4dd99e965f:disqus says above, if you use any physics, make sure you constrain the rotation and position to the planes you are working with i.e. just x and y. Some of the assets in the asset store are more there to help with texturing (to get a pixel perfect look for example) and setting up the camera for you. There are plenty of good tutorials in any case.

      • http://twitter.com/stalkbrandon Brandon V. Fletcher

        Thanks so much.

  • Becca

    @twitter-19371510:disqus You don’t need anything special to get a ‘2D look’ in unity, it’s just a case of plonking it infront of an orthographic camera and keeping the movement on two axes for the most part. The 3rd dimension still comes in handy for layering and whatnot. You can also use some of the unlit shaders if you don’t want to take advantage of unity’s lighting. If you’re just beginning to learn unity, I’d avoid venturing into the asset store, it will just slow you down.

    • http://twitter.com/stalkbrandon Brandon V. Fletcher

      Thank you! I was going to start with the Digital Tutorials until the official Unity Learning center is ready

  • Barrie

    Just had a few minutes fun with that – could be a useful attention grabber on web brochure. Nice

  • http://joshuadance.com/ Joshua Dance

    Love it. Thanks for sharing these.

  • Bryan J Bryce

    Can’t wait for the next update. Especially after your experience with Alto.

  • Tyson Cai
  • Tyson Cai

    Hey Harry,I’m your big fan from China,I really love your game.Recently I tried to make a 2D game which need a endless random terrain,and could you tell something about how did you generate the terrain for alto’s adventure?Sorry for my poor English.

    • Tyson Cai

      And another question is that is your character and animals are 3D models or just 2D sprites?