Day #009

#DAY009

Enabling Gravity on the Rigidbody of game objects.

Main points covered

#useGravity

#Rigidbody

C# script (attached to the camera)

using UnityEngine;

using System.Collections;

public class EnableComponents : MonoBehaviour
{
Rigidbody rb;

void Start ()
{
rb = GetComponent<Rigidbody>();
}

void Update ()
{
if(Input.GetKeyUp(KeyCode.Space))
{
rb.useGravity = true;
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *