Hi folks, this week we started our first project. We have a truck that can drive down a road, avoiding obstacles, or maybe not!
We created a new project in Unity, using the default 3D Core template, and called it Prototype 1.
We then downloaded and imported the assetpack from here: [Creators Teams Channel]
The asset pack already included an existing scene, which had a simple environment already. We them dragged in a vehicle and obstacle from the imported assets. Imported assets aren’t just models; they can contain Unity obstacles, such as colliders, already.

To make the truck move, we made a new C# script called PlayerController. The new C# files Unity creates always look the same (apart from the name of the Class, which matches the new file name):
We added the following code to the Update() method to change the transform of the vehicle:
// Update is called once per frame
void Update()
{
// Move our vehicle forward
transform.Translate(0, 0, 1);
}
The Unity scripting documentation can be found:
https://docs.unity3d.com/ScriptReference/index.html
and the specific page for the Transform component is:
https://docs.unity3d.com/ScriptReference/Transform.html.
This method on the Transform component that we’re calling, Translate() has several forms. The one we’re using here expects us to provide X, Y, Z values. What we’re saying we want to happen is “Change the transform by moving it 1m in Z every frame.
When we run, the car moves very fast off the end of the road. That’s because we’re running at many frames a second. It’s too fast. Next week, we’ll look at making this frame rate independent and controlling the speed.
Finally, I’ve created a GitHub repo for our projects this year. Up-to-date versions of our projects will always be available here after our sessions: https://github.com/coderdojoathenry/Creators-2022