Game Development Reference
In-Depth Information
Almost there! One last thing remains. If you run the scene now, you won't see any
change. There are no trails; the ship just sits there and does nothing. Simply put,
it's doing nothing because we haven't told it to do anything. For the Trail Renderer
to work, the ship has to move.
For the last touch, create a new C# script called ShipMove and replace its contents
with the following:
using UnityEngine;
public class ShipMove : MonoBehaviour {
void Start () {
//Kick the ship in to action with a bit of force.
GetComponent<Rigidbody>().AddForce(Vector3.forward * 50,
ForceMode.VelocityChange);
}
}
Now, simply attach the script to the SciFi_Fighter_AK5 GameObject and hit play
and your fighter will be screaming through the stars on its way to oblivion.
 
Search WWH ::




Custom Search