How to create a camera animation using SPLine in Unity?

spline camera animation in unity3d

Games are pure entertainment and with game engines getting advanced, a lot of theatrical effects are getting common everyday. One of them is the camera movement across a game environment. Camera movements are extremely important. They add as an important element to interpret and enjoy the game from a whole new level. But how do be create one? This free Unity3D Scripting tutorial can help.

You can create a camera animation using SPLine in Unity game engine. First download the SPLine package controller and have it by your side.

Go to Unity Game engine and open the controller. You will come across a number of factors to create your camera animation loop for any specified game object you desire. Set the SPLine root to game object and the required duration too. Set ‘orientation mode’, ‘wrap mode’, ‘auto start’, ‘auto close’ and ‘hide on execute’. Add the script to the object after you have set all the parameters.

The next thing to do is to create an SPLine Root –

  • Create a cube or any basic shape from hierarchy panel.
  • Set this cube as SPLine point. Make sure to set rotation of the object during the camera animation if you intend to.
  • Set points(cube or game objects) as per your path.
  • Create a parent object of SPLine points.
  • Assign this parent object in Spline controller script in “Spline Root”.

And that’s it, you have created your own camera animation. Next, time we would give you Unity3D game source code for creating an infinite 2D map in Unity. Till then, run some mocks to create your own camera animation.

How to set sprites that automatically change with resolution?

How to set sprites that automatically change with resolution

This graph depicting a ruthless android fragmentation, was released by open-signal almost 18-20 months ago. Since then the market has only fragmented further, creating thousands of screen resolutions. Even iDevices have a number of resolutions that developers are getting familiar with. In such a scenario, developers cannot custom set the control buttons. We need to device a method where it is automatically done. This is where this free Unity3D scripting tutorial will would help and it will be really quick.

Use the Set in Screen Script and tweak some values that come with it. Select your orientation and put check on ‘set automatically’. Now, in ‘My orientation’ select one of the values from the dropdown menu. Remember, this script works in both landscape and portrait orientation for the device. Icons are automatically adjusted irrespective of any resolution you put them into.

Apart from set automatically, there is another parameter called ‘isCircle’. This is useful when you are using a circular sprite in your game. The parameter ensures that the sprite remains at a desired position irrespective of any resolution.

You also have an offset parameter that ascertains the spacing of a sprite from left or right of the screen. There are X and Y parameters on the script as well that helps you to fine tune the entire thing for a better experience.

You can go through or download the free tutorial here.  Next time we will learn to make a projectile like angry birds. Till then spend some time perfecting sprites across resolutions. Cya!

Related: How to draw on canvas in Unity?

How to remove dust/fog from an object in Unity3D with swipe?

dust/fog from an object in Unity3D

This is going to an intriguing free Unity scripting tutorial that many budding developers have been searching over the web apparently. Removing fog/dust/mist from a surface of an object is quite a fundamental gimmick that you would often employ in games or apps. In Fact, numerous entertainment apps featuring have made a lot of money using this effect already.

fog in unity3d

Fog FX , Steam Window  are some of few applications that probably employed this method to create the desired effect. There are lots of other apps in the app store which have used custom shaders to create similar effects.

So how does this Unity 3D game source code work?

Using, Texture Masking shader, Mask Construction Shader, Render Texture, Camera Masking Script and Masking Camera you can create this effect.

First, employ the texture masking shader. This is going to be the upper layer that would give an impression of overlaying dust on the object. The masking construction shader would contribute for the removing effect. We would use the masking camera to visualize the dust on the object. Now, Use the script given in the tutorial to create the rubbing or dust removing effect.

The code works just fine and you can tweak it to create your own custom effect. All you have to do its to put your own desired shaders in texture masking and mask construction. In Fact, you can create better effects if you get the shaders right and a knack for aesthetics.

Next time we would learn to set sprites across all iDevices and Android irrespective of resolution.

Related: How to roll a Dice in Unity?