Posts

Showing posts from August, 2014

Look at , lerp , Destroy gameObject - Unity

Image
Look at   Lets just discuss about the code and look at use. I have used the look at function to change the direction of the camera while the game is playing. As i have created a character. Which falls on the ground. Now In order to show the ball falling look at function is used that shows while playing. Now here the script is added where in the target section i have added a moving cube. That the camera demands the object on which it have to focus. Now lets see the code that simple to understand.  Now here the Transform object reference is given which demands a particular object. That is given be given in the picture above shown.  Lerp  Vector 3.lerp is used to change the position of an object between two points. In this section i have added the lerp attribute to the camera. So the camera will move between two points. Lets see the code things will get more clear. Here on the first line a Vector3 is declared. Where in the awake transform position will assign th

How to move an object in Unity 3D

Image
How to move an Object Backward and Forward in Unity 3D !  First of all lets discuss some of the key words that are necessary to understand.  Vector 3: Its a representation of 3 vector points. You have listened the x ,y and z axis. So here vector 3 takes all the 3 values. The points in the back and forward will be (0,0,-1), (0,0,1) respectively. Time.deltatime:  Function is used to make the game rate independent. If you multiply the variable with time.delta time it means you are saying that i want to move the object 10 meter per second. Basically you use delta time to update your movements. Transform.translate:   Transform.translate is basically used for the movement of the object as it takes the 3 axis value to move the object.  It's related to the distance the object will move. Now lets see some practical example to make a object working. We take a cube for the example purpose. Then add script to it. Now lets see the played situation. As my object is mo

Vector Math - Unity

Image
Vector Math  Addition:  As you that the vector addition is defined by the combined effect of two or more than two vectors. When the tail of one vector is added to the head of other vector addition is made. This can be defined by a parallelogram.Actually joining two vectors result into a new vector. Subtraction:  Vector subtraction is performed to get the direction and distance from one object to another. The addition and subtraction of vectors is similar as the subtraction of vector will have negative negative magnitude that means opposite in direction. As in subtraction head to tail rule is also used. Dot Product : The multiplication of two vectors will result in a scalar quantity. Where Theta is the angle is multiplication of the two vectors is 0 than its perpendicular. In unity we use Mathf.Cos. Which perform equal-ant function. Cross Product: The result is perpendicular to the two vectors. The "Left hand rule" can be used to remember the d

GameObject - Unity

Image
  Game Object  Game object in unity is basically a container that requires properties to make them a character. Suppose a room the type of things you will place will be the type and use of the room. Likewise, components added to the game object will define the type of the game object. Game objects have transform component attached to it that can't be removed. GameObject.renderer  Game object renderer  is use to make character appear on the screen. It can also be used to change the color of the object. Having further different properties. To change the color of the Object  Taking a small example to learn, take a cube in the scene and add a script in the cube through add component. Then add the code given below. void Update () { if(Input.GetKeyDown(KeyCode.R)) { gameObject.renderer.material.color=Color.red; } } To make Object Transparent  GameObject g; g.renderer.material.color.a = 0.5f; g.renderer.material.color.a = 1.0f; To make an Object visib

Navigating data from one page to other page

Image
This articles is about navigation from one page to other and sending data from one page to another.  There is very simple method for the navigation. First i have created a button on a page and under that code a navigation code is written that on run time pass focus from one page to other. That page is added in the solution explorer. Apart from that a class is made where the properties methods are written.  When the information is passed from the button within the navigation code in the form of string values they are assigned to the variables in the class and that will be there until the application is closed.  Here i have added a button that will navigate from one page to other. This is the code that is written for navigation. you can see that after the question mark sign you can see the text values that will further be assigned.  Here is another sample class data. Where the variable are assigned properties. That will be used in the code below.  This

Weather application with the help of Json parsing

Image
Today, I will create a weather application using Json.   Today,  we will see an application that will give you the temperature of a country. You might have listen about the longitude and latitude. The lon. and lat. will help us to get the location of the country. The question is what's the logic used in application. The answer is that i have created a button and the textblock in the mainpage.xaml and on the click event. A code has been generated that sync the json code from the website and convert the data ! After that the temperature is displayed. In this process we have installed Newtonsoft json package in visual studio. And a class is made that is the result of json code extraction.  Now lets see how the weather application will work.  Lets first install the newton soft Json Package. In the tool box go to the library package Manager then package manger console and click it. Below there write Install Package Newtonsoft Json after writing this click enter. The package will in

Creating web form in Asp.net

Image
How to create web form in asp.net ! Creating web form is very easy. First i will create asp.net application. Them add web form in the solution explorer. Than click the design button to see the output of the source code. Then from table insert table and add desired number of rows and columns. Then add labels in the rows. After that add text-boxes to get data. Add a button write code to show all the retrieved data on label. Now i will show how to do this. I hope a brief explanation made it easy to understand !       First create a web application. Then after that add a web form in the solution explorer. For that click the application name              click Add--> Add new item --> Web form.  Click the design button in the below bar. Click the Tables button-->add tables. Then add desired rows and columns. But if you are following me than i have added 5 rows and 2 columns. Here i have edited the label that is imported from the tool box.