Hey Guys! I'm trying to make my car jump.

Before telling me that I should figure it out myself I have been trying.

The script looks like this, so far:

using UnityEngine;
using System.Collections;
public class Jump_Script : MonoBehaviour {
public float speed = 10.0f;
public float jumpForce = 1000.0f;
public float airModifier = 0.2f;
public float GroundFriction = 0.5f;

public void Update()
{
    bool grounded;

    //Are we pressing ("left or right") ("or a & d") on the keyboard?
    Vector3 horMovement = Input.GetAxis("Horizontal") * transform.right * Time.deltaTime * speed;
    //Are we pressing ("up or down") ("or w & s") on the keyboard?
    Vector3 forwardMovement = Input.GetAxis("Vertical") * transform.forward * Time.deltaTime * speed;

    //are we grounded?
    if (Physics.Raycast(transform.position, -transform.up, 2)) {
        grounded = true;
    } else {
        horMovement *= airModifier;
        forwardMovement *= airModifier;
        grounded = false;
    }

   //jump if the user pressing the space key AND our character is grounded
    if (Input.GetKeyUp("space") && grounded)
    {
        rigidbody.AddRelativeForce(transform.up * jumpForce, ForceMode.Impulse);

    }

    //move our character
    transform.Translate(forwardMovement + horMovement);
}

}

It is working with jumping in it self, but generates speed on its own. When hitting ground again, it “regains” the same amount of speed BEFORE jumping. So I was thinking, is inserting a set-amount of friction any good to this script? As in;

//After landing, set friction to negativ number.

Could this be working? or am I totally wrong about this?

Thanks for the help! :slight_smile:

@Lo0NuhtiK.
Thanks for the quick respond!
I have never tried using Wheel Colliders, so this will be awesome to test! Thanks for the help, you’re the best! And just ask away if you ever need any help, perhaps I can be of service there ;),@Lo0NuhtiK.
thanks for the quick respond!

I have never tried using Wheel Colliders, so it will be quite a test to complete this in less than a day, but never the less, I will do so! Thanks again! You’re the best! :wink: