Author:- Tushar Sonu Lambole
A) Creating the Shadow effect using directional light
1) Create empty game object name it "Game Lights" pos: x=0,y=200,z=0 scal: x=1,y=1,z=1
2) Create the directional light object name it "main light" child of "Game Lights" pos: x=0,y=0,z=0 rot: x=30,y=60,z=0
Shadow type: soft shadow/ Hard shadow
Resolution: Very high resolution
3) Create the directional light object name it "full light" child of "Game Lights" pos: x=0,y=0,z=0 rot: x= -30,y= -60,z=0
Shadow type: No shadow
select Color
Intensity: 0.1
B) Creating player with moment
1) Create the GameObject (eg Sphere).
2) Add RigidBody to the GameObject. (in Menu Commonent>Physics>RigidBody)
3) Create the new c# script "PlayerController" and copy following code to the script file
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed = 500;
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}
4) Hit Run Button. Use arrow keys to move the sphere.
C) Adding rotation to the gameObject
void Update()
{
//This line will continuously rotate the gameObject
transform.Rotation(new Vector3(15,30,45) * Time.deltaTime);
}