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?
This forum is now archived!
- Welcome to the archive!
News:
The 3DRad community can be found at classdev.net.
- 3D Rad - Free 3D game maker - Forum >
- General Category >
- 3D Rad - Artist's Discussion Forum >
- Some scripting help with car controls?
Author Topic: Some scripting help with car controls? (Read 443 times)
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?
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.
You'll need... A formula!
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.
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'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.
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
what does this question have to do with ARTISTS or ARTWORK...
please try to post in the proper forums...
--Mike
You'll need... A formula!
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
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]