Quantcast
Channel: Answers for "creating race game"
Viewing all articles
Browse latest Browse all 6

Answer by sovalopivia

$
0
0

If you're new then looking through fully fledged tutorials might be more useful to you.http://unity3d.com/support/resources/tutorials/car-tutorial Is specifically about how to set up a controllable car, how handy! and there are other tutorials there as well for other basic concepts.

But to answer your question; when you add a GameObject in Unity you can set its transform position in the inspector window, This is its position.

alt text

Or you could drag it around in the scene view.

If you just leave it like this it will start at the position you leave it in the scene view, but you can also set the car's position using scripting. In a script attached to the car you can use the Start() or Awake() function, which are only called once each, to set a starting position, like this.

void Start()
{
    transform.position.x = 5.0f;
    transform.position.y = 10.0f;
    transform.position.z = 30.6f;
}

or this

void Start()
{
    transform.position = new Vector3(5.0f, 10.0f, 30.6f)
}

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>