Monday, November 16, 2015

Tinker: Recnt Locations

Slowly but surely I am making head way. I am taking a break from programming and paperwork to start manifesting the world, that way i will have a greater connection to this project. I am stuck on bullet decals now. This is what i have so far, these are all alpha, more will be added on when i get more assets and energy.

Monday, November 2, 2015

Tinker: Forest

So i started designing the land of the game. I think over estimated the land necessary, but no matter. Ill quarantine the area off so the landscape is vivid. Currently im busy working on the Tartaric Forest. It play a key role in the game for several missions.

Also, recent assets:

Sunday, November 1, 2015

Tutorial: Player Movement and Animation

I realize that some people will want to learn how to program animated characters, move them and add other aspects. This tutorial will cover that. First thing lets head to asset store:


This model is free and offers many animations. So get that and lets make anew scene. If you are using Unity 5 you want to go to the prefab and under Animation change it to 'Legacy'. When the dialogue box pops up click "Apply".

First we have to set the scene: our skeleton will need a character controller and a camera.All i did was add a character controller component to the skeleton, set the the Y value 0.7 and holding down the shift key i adjusted the width of the collider using the little green squares on the collider. Make sure that under the Animation component Play Automatically is unchecked.                          

Next add a camera, make sure not to have the skeleton selected otherwise the camera will be added to the prefab as a component. Instead go to GameObject in the toolbar and select Camera. Position how you want it, remember we want a 3rd person in this instance. When you have done so parent the camera to the skeleton.

Now we need to start programming. Make a new script and call it SkellyWalk.cs You could make a separate script for animation, but it would be easier on everybody to merge the two.
We first need to make variables for character walk speed, run speed, float variables for the vertical and horizontal axis used for player movement, and the Animation and CharacterController objects. 

Next under Start we need to initialize the Animation and Character Controller.
So what we will do is initialize the horizontalX and verticalY variables by using the built in feature in Unity where we assign horizontalX and verticalY the horizontal and vertical values that are found under the Input.

All the information to trigger moving right or left is under the Input box, particularly the keys and alternative keys to move.

horizontalX = Input.GetAxis("Horizontal");
verticalY = Input.GetAxis("Vertical");

From here we just have to set the conditionals for what direction to move into. (When playing the animations via code it is important to correctly spell them and know them. By this i mean look at the animation component under your prefab/model.)

if(verticalZ >= 0.1f)
           skellyAnimations["WalkO2"].wrapMode = WrapMode = Default;
           transform.Translate(Vector3.forward *  Time.deltaTime * skellyWalkSpeed);

What we are doing is taking the Walk02 animation and using the default wrap mode. When you play an animation in Unity you have a few ways to play it, these are to ensure that the animations are smooth. For full details consult the documentation. The we CrossFade the animation. Cross Fading is used when there are two or more animations, it is to insure smooth transition between the animation states. finally using the transform.Translate function we move forward with each frame at the speed of the Skeleton we designated. The next few lines will be similar and cover left right, backward and idle. So i will just upload the picture instead of typing it.


Now if you want it to have a sword there are many free ones on the asset store.
I took this one: Rune Broad Sword

The next step is to attach it properly. You want to scale the sword the right size then position it the right way. If you don't when the swing, or walk or block animation plays the sword movements will look ridiculous.

Note that the sword is parented under Bip01_R_Hand. Now add the following code anywhere in the Update():

           skellyAnimations["SwingNormal"].warpMode = WrapMode.Default;