[SKIP THE BLABLA AND GIVE THE GAME A TRY[/B][/URL] Hello people, let me introduce myself : I’m Sohaib, a 17 years old computers amateur, i’ve a basic knowledge in C#, i can handle things pretty well in photoshop. I’ve heared about Unity and it’s been always my dream to create and manage games, so i’ve decided that my first project should be a free-to-drive-car game. Details: there isn’t much details about it, it’s just a car that you drive all over the terrain. I brought the terrain textures the car from the Assets Store, i edited the car’s color and added that cute logo. the movement basics are simple: Z move forward, S backward, if you’re already moving, you can turn left or right. First, i had issues because the vehicle was falling throught the terrain, even if it’s a rigidbody, i added a box collision to it(the only one that worked) it solved the problem but i’m still feeling it’s the wrong way to do it. To be honest with you, physics are pretty messed up, and my first goal from making this thread is improving my project and knowing where should i correctly start from. This is the C# class that’s moving my car: ```php
**using UnityEngine;
using System.Collections;
public class CarDriver : MonoBehaviour {
public float forwardSpeed = 40.0f;
public float backwardSpeed = 20.0f;
public float rotateSpeed = 80.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.Z))
{
transform.position -= transform.forward * forwardSpeed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.S))
{
transform.position += transform.forward * backwardSpeed * Time.deltaTime;
}
else if (Input.GetKey(KeyCode.S))
{
if (Input.GetKey(KeyCode.Q))
{
transform.Rotate( 0.0f, rotateSpeed * Time.deltaTime, 0.0f);
}
if (Input.GetKey(KeyCode.D))
{
transform.Rotate( 0.0f, -rotateSpeed * Time.deltaTime, 0.0f);
}
}
}
}** ``` and these are some screenshots: Thank you for checking my thread, i hope that who know better than me enlighten me with his knowledge. Any criticisms is always welcome](http://neoxads.com/sohaib/Car.html)
I added a re-spawn script if you fall from the terrain, and also a “SPACE” key for it
Realized that the car is too light and that’s why it flies all over the terrain and falls slowly
Realized that the car weight problem is because everything is big in the project and newton says that all objects fall with the same speed no matter how heavy they were.
Set up a SmoothFollow script on the camera(it’s in the default assets of scripts). Set it to follow the vehicle. Also, show us a pic of your rigidbody settings. The car, as you said, is falling down pretty slow. We can provide assistance in trying to solve it.
Biggest stand out, other than gravity speed is that you can drive and steer while in the air! I think a raycast from the back two tyres to toggle forwards/backwards, and a raycast from the front two tyres to toggle left/right should fix this.
i tried to add a wheel collider to each tire, everything got screwed
i also added the smooth-follow script
@oysterCAKE i didn’t really understand you, because my driver script is very basic, there’s nothing mechanic, i’m just messing with coords through keys, is there really a way to make the wheels turn and add a friction force like in real life?
It seems as though you are applying force to the car to make it move. You shouldn’t do this. Instead make each individual wheel have its own collider and rotate each through the physics engine. This way you will get a lot better acting car instead of a helicopter-ish car thing.
I removed that stupid box collider thing, then i added new colliders that are more organized and a lot more accurate.
4 Wheel Colliders
One big box collider for the body
One smaller box collider for the updder body
This is a small screennie about it
I also multiplied the gravity by 10, because the terrain is x10 bigger than the real world, now it’s a lot more realistic
my next task is making the weels turn and make the friction between the terrain and the wheels is what makes the car move, i still didn’t figure out the way to it, but working on it