3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Some scripting help with car controls?  (Read 443 times)

« on: July 29, 2013, 03:31:36 AM »
I have tried fiddling around myself but i'm barely into scripting. I have been trying to make it so that (in a wheeled vehicle such as a rigidbody and wheels) the two front wheels of a car turn at 30-degree angle at low speeds and 15-degree angle at high speeds. Any suggestions and help please?  :)
« Reply #1 on: July 30, 2013, 02:21:17 PM »
Why not just use the pcar and use the input for speed to control the output for maximum steering in a handy 'if/else' statement?
« Reply #2 on: July 30, 2013, 05:00:53 PM »
I've tried that beforehand, the thing is I would not be able to add a skinmesh to the wheels of the car. I was wondering if I could keep the rigidbody and the four wheels while making the handling like so. I couldn't find out how to make a script to change the steering smoothly.
« Reply #3 on: July 31, 2013, 03:04:28 AM »
You'll need... A formula!  ;D

Voila:

SteeringAngle = (a2-a1)/(v2-v1)*Speed + a1 - (a2-a1)/(v2-v1)*v1;
if (Speed < v1) SteeringAngle = a1;
if (Speed > v2) SteeringAngle = a2;

...Where v1 is the lower boundary for the speed (the point from where the steering angle should be less) and v2 is the top boundary. Same goes for a. a1 is the the steering angle when you go slow, a2 is used when you drive fast.

If you give me a moment, I'll put together a demo.

EDIT: Demo attached. And I made a mistake in the formula...  ::) Fixed now.
« Last Edit: July 31, 2013, 03:15:37 AM by RobertooMolvadoo »
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #4 on: July 31, 2013, 03:18:28 AM »
I've tried that beforehand, the thing is I would not be able to add a skinmesh to the wheels of the car.

Sorry - I may have missed something, but why couldn't you do this?

Attaching separate wheel skinmesh to the wheels of the car object is covered in this tutorial here - http://www.3drad.com/start03.php

Don't worry that it's the old car object - this works just the same on the pcar.
« Reply #5 on: July 31, 2013, 06:01:34 AM »
it says ARTIST'S DISCUSSION FORUM up there... doesn't it...

what does this question have to do with ARTISTS or ARTWORK...

please try to post in the proper forums...

--Mike
« Reply #6 on: August 02, 2013, 09:26:58 PM »
You'll need... A formula!  ;D

Voila:

SteeringAngle = (a2-a1)/(v2-v1)*Speed + a1 - (a2-a1)/(v2-v1)*v1;
if (Speed < v1) SteeringAngle = a1;
if (Speed > v2) SteeringAngle = a2;

...Where v1 is the lower boundary for the speed (the point from where the steering angle should be less) and v2 is the top boundary. Same goes for a. a1 is the the steering angle when you go slow, a2 is used when you drive fast.

If you give me a moment, I'll put together a demo.

EDIT: Demo attached. And I made a mistake in the formula...  ::) Fixed now.

I was hoping for something like this, though it mentions the angle only though and doesn't seem to change it, but ima see what I can do, thanks for the help  :D


it says ARTIST'S DISCUSSION FORUM up there... doesn't it...

what does this question have to do with ARTISTS or ARTWORK...

please try to post in the proper forums...

--Mike

My apologies!
Pages: [1]