December 2011
Beginner
488 pages
11h 47m
English
Now
within this IF statement—meaning after the opening { and before the closing }, put the following line:
C#:
Rigidbody instance = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
Javascript:
var instance: Rigidbody = Instantiate(bullet, transform.position, transform.rotation);
Here we are creating a new variable named instance. Into this variable we are storing a reference to the creation of a new object that is of type Rigidbody.
The Instantiate commands requires three pieces of information namely, Instantiate(What to make, Where to make it, a rotation to give it);
So in our example, we are telling our script to create an instance of whatever object or prefab is assigned to the bullet ...
Read now
Unlock full access