Wipeout style Racing game

Hello

I am pretty new to unity and I am trying to do a wipeout style race but dont really know what to do with scripting as I am a bit of a newbie. I have looked at other posts with similar requests, however for my game I want the racing cars to stick to the track as I have a section where the track takes you upside down and into a tube, I have give it basic controls but they dont feel right, as soon as I turn it seems to spin out of control. I have used the racing tutrial for my script but I am not using wheels, also unity crashes everytime I get to the AI part of the tutorail so I dont know what is happening there as my pc is fine with most things, Maya 3DS Max etc.

I know this is alot to ask but any help would be great for scripting, here is my script so far…

var speed = 10.0;
var rotateSpeed = 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)

Sorry about being such a newbie its basically scripting, probably some more stuff aswell that I need helping with.

273316–9821–$test001_144.html (8.01 KB)

Your game doesn’t want to load on my pc, but after a quick check of the code, it looks like soemthing is wrong. In fact, with transform.Rotate you are adding a rotation to the actual one: when you relase the Left or Right key, the ship will continue to spin because your rotation never fades out.

I suggest to use rigidbodies instead of direct controls. I managed to get something interesting with that, but the main problem is getting the ship sticked to the track. It’s quite difficult and I don’t find any script that can handle that directly.

Sorry but I’m not an expert, so I can’t help you very much!

Hi

heres the link see if that works

file:///F:/Unity/Unity%20Projects/Racing%20Game/Web%20Builds/Test001.html

I have give it a rigidbody ticked gravity and kniamatic the rotation seems to be ok atm though at rotating.

Ehm… You linked the file on your hard disk!

Anyway you should disable kinematic if you want to use a good physics!
Then you will have to change the controls to Rigidbody.addRelativeForce and rigidbody.addRelativeTorque in order to move it. :wink:

Hey is that a script, what would I need to do?

I keep getting this aswell

Assets/Smooth Camera.js(42,38): BCW0012: WARNING: ‘UnityEngine.Quaternion.EulerAngles(float, float, float)’ is obsolete. Use Quaternion.Euler instead. This function was deprecated because it uses radians instad of degrees.

But when I change it to quaternion.euler it doesnt work.

I vote this to be the funniest thread of the year, whos with me?

well like I said im a newb

Can you post your script in its current state?

this is my script for it

var speed = 10.0;
var rotateSpeed = 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)

The main thing with the rotation is that you are not scaling it by Time.deltaTime:-

transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed * Time.deltaTime, 0);

Without this, the turn angle will be incremented each frame, regardless of the amount of time that has passed.

Thanks for that it worked fine. I just have to sort out some other stuff now

Heres a proper link to it