Posts Tagged ‘Controller’

Unity: Normal Walker

Click here to read Unity: Normal Walker

This Unity programming tutorial explains how to create a controllable character that appears to ‘walk’ on the surface of another object. That’s achieved by using a script that matches the normal up orientation vector of the controllable game object with the surface normal of the other 3D object. But not only the script, this post also explains how to set up a scene to make it work.

A demo project with everything discussed here is available at the end of the post both in C# and JavaScript.

The first step is to create a Cube game object, that will act as your player. To do it, just select GameObject->Create Other->New Cube: (more…)

Unity: Rotation Controller

Click here to read Unity: Rotation Controller

Another day, another Unity3D programming post. This tutorial contains not just one, but two scripts that rotates a game object around another one, based on the keyboard input. Again, like the previous tutorial, this was also inspired by retro games, such as S.T.U.N. Runner or the special stages from Sonic 2, where the player controls the main character by pressing left or right, making it complete a full circle in the screen. However, unlike those games, the below scripts aren’t applying gravity to the player, for the sake of simplicity. Everything explained here is available for download at the end of the tutorial.


Unity: Throttle Controller

Click here to read Unity: Throttle Controller

This Unity programming tutorial will explain how to create a script that translates the containing game object forward at a pre-defined speed rate. This rate is controlled by a throttle much like the ones found in boats, planes or even trains. As usual, a Unity project with a working demonstration of this code is available at the end of the post.

The inspiration behind this tutorial came from the first Half-Life game, in which a train at the end of the tutorial level can have its velocity is gradually set by the player. Some of you may not remember how it looked like, so here’s a screenshot: (more…)