streamhoogl.blogg.se

Unity 3d characters
Unity 3d characters














#UNITY 3D CHARACTERS CODE#

This function – stopTurning – does exactly that and stops the animation if need be.įunctions run by the left and right arrow keys move the character wheel left and right.īoth of the above functions – stopTurning and startTurning – contain a line of code that relates to the animations speed. Every 72 degrees (as in, every point the a Spangle is in the foreground) a function is triggered. It cycles through 360 degrees in about three seconds, although those measurements aren’t to be relied upon. It defaults to 4 because of where the animation starts.Īs said before, the spinning is done through the Animation window. We’ve got a variable called currentCharacter which stores the number of the Spangle chosen. static var currentCharacter : int = 4 function Start () Basically, it rotates 72 degrees and stops in whatever direction you push on your keyboard.

unity 3d characters

The GameObject has a rotation animation on it, which is designed to stop as each cube hits the foreground. Bit of an oversight on my part, I apologise. The cubes are numbered 1-5, but internally referenced as 0-4.

unity 3d characters

We’ve got a GameObject which contains five numbered cubes (placeholders for when we get the characters made). Our game allows you to play as five fruits competing to be the new flavour in a packet of Spangles. The game starts with the character selection screen. We’ve taken a few of our steps alongside some elements talked about in Unity’s 2D Gameplay Tutorial, with such things like the death area and prefab panels, but we’ll come to those in a later post. They aren’t the most riveting of elements, but it’s only the building blocks.

unity 3d characters

Our idea, as you may have seen, was a Sonic-like game with Total Wipeout tendencies.īut of course, every game needs to start somewhere, so we’re in the process of making some prototypes in Unity 3D. As a major part of our rebrand of Spangles in this university project, we need to do a game.














Unity 3d characters