Trying to Make a Wipe Out Style Racer Movement

Hello!

I have a few newbish questions so if you don’t answer I’d understand but be sad :frowning:

I am trying to create a racing game with movement that is similar to Wipeout or F-zero. The cars in those games move more similarly to a jet than a car. I did some research and found the 2D movement tutorial, the ship in that has movement that is close to what I am trying to achieve. It basically has the acceleration/deceleration that I am looking for. I did a bit more research and discovered that the ship in that tutorial uses the Configurable
Joint physics component.

Currently I have a ship that moves quickly when I press the acceleration button but it stops shortly after I release the button. I have also managed to Limit the ship’s turning radius to 90 degrees.

What I want to achieve is:

A ship that moves after the player stops pressing the acceleration button if he is going at a certain speed. (I basically don’t want the player to stop on a dime if he stops hitting forward)

I also want the ship to be able to turn but I think that a ship being able to rotate 360 degrees on the x axis is weird behavior for a racing game.

So I guess my question is where do I begin?

What is the best way to get the type of movement/speed that I am looking for?

Are the Unity Psychics components the answer?

To what extent do I need to script this behavior?

I’ve looked at the Car Tutorial, the physics are closer to what I want but It uses wheel collides Is there any way to make it more like a flying machine?

Sorry for the length but I appreciate any help or insight you guys can provide.

-Marvin

you definitely want your vehicle to be some sort of collider and use the physics system.

I think you can go a long way with wheel colliders. They are easiest because they have friction/slipping models built into them.

Else you probably want to use raycast Colliders. This will mean you have to built your own friction system but are less restricted.

Also do some tests with the scale and size of your objects and colliders. Make everything in real world sizes. And don’t make your roads/walls to thin or things will go through them.

Good luck!

you should be able to script a simple accelerate/decelarate script no problem. I haven’t looked at the ship from the tutorial, so not sure how it’s movement is defined, but, something like this should at least give you a base

// set up variables to let you control the rates of acceleration and decelaration, also to set a standard speed rate.
var maxAccel = 10;
var accelRate = 0.05;
var decelRate = 0.75;
var acceleration = 0;
var speed = 20;

function Update(){
//check if forward is pressed
if(Input.GetKey ("up")){
if forward is pressed, then we are going to up the acceleration while it's held down until we reach the max speed.
if(acceleration<maxAccel){
acceleration = acceleration+accelRate;}
}else{
//if we let go of forward, acceleration will drop to nothing
if(acceleration>0){
acceleration = acceleration-decelRate;
}}
//calculate the distance to move based on speed and acceleration
var move = speed * Time.deltaTime * acceleration;
//move it that amount in the x axis
transform.Translate(move, 0, 0, Space.World);
}

This probably isn’t the best way of doing this as I’m still a newbie and learning myself, but hopefully it will at least point you in the right direction.

Thanks guys! I’ll revisit the Car Tutorial too… The physics in that are just odd.

I’m also struggling a bit with the logic of winning a race. How does one check to see what the player’s or AI’s position is to the rest of the field? Thanks again.

You could maybe do a render texture on one of the cameras. Set up a camera overhead so that it is looking down at the entire track then you will be able to see in real time where the cars are on the track.

You can also use the motion blur image effect (Unity Pro) attach that to the camera on your players car. But with that it will probally end up looking like the Burnout games.

marvinhawkins - depending on how your track is built, there are two standard ways of checking positions/win criteria.

You can have a series of checkpoints placed throughout the track that you have to pass through in order. This will give you a coarse position, but to get it finer, if two ‘cars’ are on the same checkpoint you could check distance to next checkpoint or something like that to see who’s in front.

The second method is to have a spline running through your track and to do some kind of raycast or distance check to it so you can tell how far along the spline each car is. To be honest I’m not sure how you’d pull that off with Unity, but the approach is sound and it’s more flexible than the checkpoint method.

If you have a seperate collision model for the track you could use the UV set on the collision model to figure out how far along the track a car is.