Pages

Wednesday, June 29, 2011

How To Create MENU Of Game

For That We need to Declare Number of System File Like :

Sunday, June 26, 2011

GUI Basics For The Unity3d

Making Controls with UnityGUI

UnityGUI controls make use of a special function called OnGUI(). The OnGUI() function gets called every frame as long as the containing script is enabled - just like the Update() function.

Code :

function OnGUI () 
{
    // Make a background box
       GUI.Box (Rect (10,10,100,90), "Loader Menu");
   if (GUI.Button (Rect (20,40,80,20), "Level 1")) 
{
        Application.LoadLevel (1);
      }
   // Make the second button.
   if (GUI.Button (Rect (20,70,80,20), "Level 2")) 
      {
        Application.LoadLevel (2);
      }
}
 
It Will Look Like This :  
 
 
 
 
 
Now Controls in GUI : 

How To add Lable in GUI ?
 
-->  CODE : 
function OnGUI ()
{
   GUI.Label (Rect (0,0,100,50), "This is the text string for a Label Control");
 }
 
If you Want to Add Texture2D then it calls like 
 
--> var controlTexture : Texture2D;

function OnGUI () 
{
    GUI.Label (Rect (0,0,100,50), controlTexture);
}  
 
How To Add Button in GUI Function ??
--> Code : 
 var icon : Texture2D;

function OnGUI ()
{
    if (GUI.Button (Rect (10,10, 100, 50), icon)) 
{
   print ("you clicked the icon");
       }

    if (GUI.Button (Rect (10,70, 100, 20), "This is text")) 
{
  print ("you clicked the text button");
       }
} 
 
 
---
Vivek P Shah
Game Developer in Unity3d  


Basics Of Collision and Collider Cont ...


Wheel Collider

The Wheel Collider is a special collider for grounded vehicles. It has built-in collision detection, wheel physics, and a slip-based tire friction model. It can be used for objects other than wheels, but it is specifically designed for vehicles with wheels.



Properties



CenterCenter of the wheel in object local space.
RadiusRadius of the wheel.
Suspension DistanceMaximum extension distance of wheel suspension, measured in local space. Suspension always extends downwards through the local Y-axis.
Suspension SpringThe suspension attempts to reach a Target Position by adding spring and damping forces.
SpringSpring force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster.
DamperDampens the suspension velocity. A larger value makes the Suspension Spring move slower.
Target PositionThe suspension's rest distance along Suspension Distance. 0 maps to fully extended suspension, and 1 maps to fully compressed suspension. Default value is zero, which matches the behavior of a regular car's suspension.
MassThe Mass of the wheel.
Forward/Sideways FrictionProperties of tire friction when the wheel is rolling forward and sideways. See Wheel Friction Curves section below.

--
Vivek P Shah
Game Developer in Unity3d
Source : www.unity3d.com