It has rightly been said that the day without learning something new is a day that has gone waste.

First things First, Have you ever wondered about the games that are made based on the TRON movie? We see some cool bikes with flashing trails following them. That is remarkably unique in its own way.

In terms of common language, we call them a WOW EFFECT, but coming in terms of UNity, It is a LineRenderer.

“The line renderer is used to draw free-floating lines in 3D space.

This class is a script interface for a line renderer component.”

using UnityEngine;
using System.Collections;

public class LineScript : MonoBehaviour {
     /// The line renderer component that is attached to the gameObject.. 
     LineRenderer lineRenderer;
     /// The cube that we are finding in the scene. ///

     GameObject cube; // Use this for initialization 
     void Start () { 
         lineRenderer = gameObject.GetComponent<LineRenderer>(); 
         //the cube that is in the scene has beeen assigned the tag as a player. 
         cube = GameObject.FindWithTag("Player"); 
         //It has two indexes by default. The initial point denotes the Index 0, and the 
         //final point(of the line renderer) denotes the index 1 
         lineRenderer.SetPosition(0, cube.transform.position); 

         //Set the width of the line renderer. 
         lineRenderer.SetWidth(0.5F, 0.5F); 
     } 

     void Update() { 
        //the end position of the line will follow the player where ever it goes. 
        //This is the effect that I am talking about. 
        lineRenderer.SetPosition(1, cube.transform.position); 
     } 

}

So, another script will be attached on the cube which will move in a direction..

      //Cube script. Attach this script to a cube and give it a tag name "Player" via the inspector.
         bool canMove = false;
	// Update is called once per frame
	void Update () {
		if(Input.GetMouseButtonDown(0)){
             canMove = true;
			Invoke("StopMovement",4f);
        }
		if(canMove){
			transform.Translate(Vector3.right * Time.deltaTime * 10f);
		}
	}
        //Stop the movement of the cube.
        //So, The player will stop moving and you can see a pretty good trail.
        // If you want a fancy one, then attach a pretty decent material to it.
	void StopMovement(){
		canMove = false;	
	}

So, after a lot of hard-work(Pheww) we're finally done with Line Renderer part. Let me show you a screen shot. Of course with a fancy material.

1

2

Hope this will help you.

Sid ;)

Well, So here I am again at your service. Haha, just joking. So you might be wondering what this post is all about, eh?

Many people are in the habit of avoiding long searches to find the best available solution/link for a particular problem. Well as a beginner, we all are normally confused on how a particular thing can work, so we just start googling (a jargon for me, btw) for solutions. Sadly, the same was for me when I stepped up into Unity3D.

Normally, a good developer or a designer is a person who saves the references/links that might come into handy for himself  at any point of time( just to avoid the searching time). So I (actually me and my colleague) did the same thing. We shared the sheet containing links to some awesome posts on Unity3D and so I am sharing with you all.

Here are the links, Don’t get dizzy though, the links are simple and easy to understand:

http://wiki.unity3d.com/index.php/Server_Side_Highscores

http://www.domebase.org/6—unity-animation-samples

http://wiki.blender.org/index.php/Doc:2.6/Manual/Game_Engine

http://benryves.com/tutorials/tunnel/all

http://active.tutsplus.com/tutorials/unity/getting-started-with-unity-finishing-our-game-with-a-menu/?search_index=13

http://www.41post.com/2868/programming/unity3d-programming-a-machine-gun-part-2

http://www.41post.com/2868/programming/unity3d-programming-a-machine-gun-part-2

http://www.saintannsny.org/depart/computer/classes/gameprog/miker_unity_scripting_tutorial.html

http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html

http://active.tutsplus.com/tutorials/unity/getting-started-with-unity-finishing-our-game-with-a-menu/

http://www.digitaltutors.com/11/learning_path.php?lpid=38

http://blogs.unity3d.com/category/tips/

http://blogs.unity3d.com/2011/09/20/animating-skinned-mesh-along-waypoints-in-unity/

http://www.rocket5studios.com/tutorials/creating-2d-games-with-unity3d-part-1/

http://www.gameobject.net/beginner-game-programming-tutorials/

http://forum.unity3d.com/threads/48601-Swipe-help-please

http://forum.cgpersia.com/f33/unity3d-fingergestures-43208/

http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture…http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture…http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture&#8230;

http://active.tutsplus.com/tutorials/unity/getting-started-with-unity-colliders-unityscript/    ***collider tree ***
https://gist.github.com/    ****github***

http://www.untoldentertainment.com/blog/2010/12/23/dynamically-add-a-gameobject-to-the-scene-in-unity-3d/

http://answers.unity3d.com/questions/9729/how-can-i-display-a-flat-background-2d-image-not-a.html    BACKGROUND IMAGE

http://forum.cgpersia.com/f33/unity3d-fingergestures-43208/

http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture…http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture…http://forum.unity3d.com/threads/14219-Sliding-finger-%28touch%29-gesture&#8230;

http://www.mixamo.com/c/help/workflows_unity    animation

http://answers.unity3d.com/questions/307437/fade-skybox-to-black.html    ***fade in fade out skybox******
http://answers.unity3d.com/questions/9729/how-can-i-display-a-flat-background-2d-image-not-a.html    *****bg image*****

http://forum.unity3d.com/threads/91726-Flicking-Shooting-Throwing-Tossing-Lobbing-Slicing-script.    ****important*****

http://forum.unity3d.com/threads/91726-Flicking-Shooting-Throwing-Tossing-Lobbing-Slicing-script.

http://wiki.unity3d.com/index.php?title=SplashScreen    ******splash screen Code******
http://u3d.as/content/dinzy-labs/bubble-shooter-starter-package/3V6    ****shooter game…
http://answers.unity3d.com/questions/369987/help-with-game-mechanics.html    ***bubbles help****
http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html    *****mesh vertex calculate*****

http://buchhofer.com/category/scripting/unity/

https://github.com/mikelovesrobots/unity3d-trigger-action-pattern    /****Action Pattern*****/

http://answers.unity3d.com/questions/290695/calculate-spline-points-on-complex-geometry-mesh.html

http://dkoontz.wordpress.com/tag/unity3d/

********main menu **********

http://purdyjotut.blogspot.in/2011/02/creating-game-in-unity-part-1-main-menu.html

http://www.virtualgamelab.com/unity-resources.html

http://www.redsorceress.com/skybox.html    *****SKYBOX******
http://www.tanukidigital.com/suimono    ****Water Effect
http://forum.unity3d.com/threads/56180-Strumpy-Shader-Editor-Now-Open-Source/page69    ***Shader**

http://thegoldenmule.com/blog/?p=80

http://wiki.unity3d.com/index.php/Saving_and_Loading_Data:_XmlSerializer    ***saving & loading data ****

http://www.rocket5studios.com/tutorials/creating-2d-games-with-unity3d-part-4/

http://answers.unity3d.com/questions/335263/how-to-make-a-slope.html    **slope

********************game play

http://tomislavbali.com/tg/

http://forum.unity3d.com/threads/173260-Endless-2D-terrain

http://catlikecoding.com/unity/tutorials/runner/    ******runer Game

http://unitygems.com/basic-ai-space-shooter/***Ship

http://unitygems.com/saving-data-1-remember-me/    ***********SAVE DATA**********
http://www.creativetd.com/?page_id=617    *****shader

http://unitygems.com/noobs-guide-shaders-2/

http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html

http://docs.unity3d.com/Documentation/Components/SL-Reference.html

http://en.wikibooks.org/wiki/GLSL_Programming/Unity

http://wiki.unity3d.com/index.php/Server_Side_Highscores    *****Php\

http://unitycoder.com/blog/    ********Unity Coder…

A Star Algorithm References

http://en.wikipedia.org/wiki/A*_search_algorithm

http://upe.acm.jhu.edu/websites/Benny_Tsai/Introduction%20to%20AStar.htm

http://www.policyalmanac.org/games/aStarTutorial.htm

http://www.gameai.com/papers.php?a=&t=AStar&e=&y=

http://theory.stanford.edu/~amitp/GameProgramming/

http://heyes-jones.com/astar.php

http://www.rocket5studios.com/tutorials/make-a-2d-game-with-unity3d-using-only-free-tools-beginning-enemy-ai-with-a-pathfinding/

So I hope these all will be useful to you which ultimately will reduce your search time.

Sid ;)

Well here I am for yet another exciting post on Unity3D. Today I’ll be telling you how to restrict the player’s movement in a particular range. I’ll be doing it here for the X-Axis and Y- Axis. You can do the same for Z-axis too. Its not that difficult. I’ll assume that you have at least some basic knowledge of Unity Scripting. For more detailed information, you can refer to the Unity3D scripting references. Before beginning, Unity is all about a 3D Vector, since the objects are represented as 3D vectors in real space. Here, Vector3 Comes into play.



GameObject ball;
void Start(){
        ball = GameObject.FindWithTag("Ball");   //Find the game object in the scene whose tag is "Ball".
}

// If Player's X exceeds minX or maxX..

if (ball.transform.position.x <=minX || ball.transform.position.x >=maxX)
{
    // Create values between this range (minX to maxX) and store in xPos
    float xPos = Mathf.Clamp(ball.transform.position.x, minX + 0.1f, maxX);

    // Assigns these values to the Transform.position component of the Player
    ball.transform.position = new Vector3(xPos, ball.transform.position.y,0);
}

// If Player's Y exceeds minY or maxY..
if (ball.transform.position.y <= minY || ball.transform.position.y >=maxY)
{
    // Create values between this range (minY to maxY) and store in yPos
    float yPos = Mathf.Clamp(ball.transform.position.y, minY, maxY);

    // Assigns these values to the Transform.position component of the Player
    ball.transform.position = new Vector3(ball.transform.position.x, yPos,0);
}

So this is how it works. I've attached the links with the code. So that it works fine and If you're having any problems with it, you can  just click on the highlights.

Cheers,

Sid ;)

Yes, it has been said truly that Unity3D is a powerful game engine which works on a simple principle – “Code at one place, and deploy to various places (platforms namely PC, Web, Android, iPhone namely iOS).”, which I thought that its a myth. BUT its true.

So during these four months i’d developed two games in unity3D, and have gone viral in the public market. Hope those two spread like an epidemic.

You can check these out form the following links.

1.) Cave Runner HD

images                    

Play on Facebook. Do like the Fan page.

Here are some game play scenes from the game.

2.) Penguin 3d Racing : Cube Wars

      Go to Market

Get Penguin 3D racing on Google Play Store.

Penguin 3d Racing. Get it on Google Play Store

 

So I hope you’ll love these two flicks that I’ve made and I’ll continue to make more and more.

Regards

Sid ;)

Hi all, now I’ve been migrated to Unity3D to make high end 3D games, so i guess its now a farewell to OpenGL ES? Hmm, well I guess so, NO because OpenGL ES is just for your knowledge on how things work at the back-end and what are the basics behind a particular scene. For example, To draw a cube programmatically , you need to define the co-ordinates of the vertices and have to choose what kind of triangles you need to use(plain old triangles, triangle strips or triangle fans), sounds hectic, right? I guess so yes, because my reaction was like a BIG Question MARK on my face.

So, let me tell you what exactly Unity3D is,

Unity is a rich 3D game engine for creating interactive content.
The exciting thing about Unity 3D is the speed and efficiency. It is simple to set up, it runs quickly in a browser and across platforms including Windows, Mac, Android and iPhone/iPad as well as games consoles and it allows us to develop for all these platforms from a single source.

This means, all i have to do is code at one place and deploy it simultaneously to iPhone, Android, PC, Mac etc. Quite a relief to all my folks having the iPhone.

You have three options n which you want to do the programming, basically scripting, namely C#, Java Script and Boo.

Since I am comfortable with java, so i’ll do my scripting in C# only. Hardly matters as most of the syntax is the same.

I’ll be posting most of my work from unity here so I guess it would be helpful to all.

Regards,

Sid ;)

In openGL ES, there are 3 fog modes that are available to us. These are displayed in the table below :

Flag Description

  • GL_EXP This is the simplest form of fog. Objects do not really appear to move in and out of the fog. This just creates a simple haze effect.
  • GL_EXP2 This is a more advanced version of the previous fog mode. Objects now appear to move in and out of the fog . You may notice that the fog does not appear completely realistic as a distinct line  can be seen at the point where the object is moving out of the fog.
  • GL_LINEAR This is the most realistic fog mode. Objects appear to come in and out of the fog properly, giving a realistic fog effect.
gl.glEnable(GL10.GL_FOG); // 1. to enable the fog
gl.glFogf(GL10.GL_FOG_MODE, GL10.GL_EXP2); //2. set the fog mode.
gl.glFogfv(GL10.GL_FOG_COLOR, fbbb); // 3. to set the fog color, it takes a framebuffer value.
gl.glFogf(GL10.GL_FOG_DENSITY, 0.1f); // 4. density of the foggy fog</span></span></p>

This function allows you to specify how important the look  speed of your effect is.
The first parameter can be a number of values such as GL_FOG_HINT, GL_LINE_SMOOTH_HINT,      GL_PERSPECTIVE_CORRECTION_HINT and GL_POINT_SMOOTH_HINT.
We will only be dealing with the GL_FOG_HINT flag.

The second parameter can be either GL_DONT_CARE, GL_FASTEST or GL_NICEST.
If we want our fog to look as good as possible, we would pass on GL_NICEST.
If we are concerned more with speed, we would pass on GL_FASTEST.
The default value is GL_DONT_CARE.
This will enhance the effect of the fog only if there is enough time to do so.

We pass GL_DONT_CARE onto the glHint function below.
This is not necessary as this is the default value anyway.
We are showing it here just so that you know that you can increase the fog effect further.

gl.glHint(GL10.GL_FOG_HINT, GL10.GL_DONT_CARE);
gl.glFogf(GL10.GL_FOG_START, 10.0f); //near and far distances
gl.glFogf(GL10.GL_FOG_END, 15.0f);

Well to use a framebuffer object in the line 3, you can refer this function. It takes a float array and returns a FB Object.

float fogColor[] = { 0.5f, 0.5f, 0.5f, 1.0f }; //a fog of gray color is used here,
//you can change the values and create fog colors as per your need.
FloatBuffer fbbb;

public MyRenderer(Context context) // the renderer class constructor
{
this.context = context;
.
.
.
fbbb = makeFloatBuffer(fogColor);
}

protected static FloatBuffer makeFloatBuffer(float[] arr)
{
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length*4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer fb = bb.asFloatBuffer();
fb.put(arr);
fb.position(0);
return fb;
}

The above example is working fine.

Regards,

Sid ;)

Happy New Year 2013

Posted: December 31, 2012 in Coding
Tags: , , , , ,

Well, First of all i’d like to say hello to all of you out there reading my post.
2012 is ending and to be frank with you, it was a period of ups and downs. But the best part is that I work what I love and I Love what I work.

I’d like to wish all of my readers a very happy and a prosperous new year 2013.

According to me, New Year is not just full of resolutions and wishes and promises etc etc… But it is the joy, inner peace, strength and the melodious tune that makes us forget even the worst of the times that we stumbled upon.

After all, its the new year, So party hard.

Live like a King and Party like a Rock Star.

Happy New Year 2013. Welcome it with a Blast.

Happy New Year 2013

Regards,
Sid ;)