1. #1
    T4KShadow's Avatar Senior Member
    Join Date
    Apr 2014
    Posts
    1,787

    Best way to steer a car?

    Sorry to keep asking about this whole steering business but I'm not getting any answers.

    I'll explain it again; I'm using the pre-made Car example with the physic wheels and rotation hinges.

    I've got the car accelerating/reversing and all that but I can't get the steering right. I used area effector tools earlier to apply force to the front-right/left sides of the car and that kind of worked, but it was blowing the car over and the car looked to jerky and wobbley.

    Is there anyway I can make the example wheels/rotation hinges turn?
    Share this post

  2. #2

    Re: Best way to steer a car?

    Use the example of a FPS, the game character (a chrome ball with camera attached) can rotate left and right with an area effector that snaps to the middle of the ball (using object position event and data sources to get the information)

    I guess you could try applying the same thing to your car (: the rotation given to the chrome ball/game character in the fps example doesn't rotate too fast so wouldn't look too weird with the car if applied to the front of it.
    Share this post

  3. #3

    Re: Best way to steer a car?

    i've been looking into this myself because after my complete failure at making an FPS game, i've turned my attention to making a realistic car.

    the easiest way to do this would be to leave each wheel as non steering wheels, but rotate the car with an object position event. you could feed the left stick horizontal value into an increase value event, which is linked to the rotation of the car. i'm not sure if you can affect the rotation of the car directly from the increase value event, or if it needs to go through the object position event.

    for a more realistic method you will want a rotation hinge for each front wheel. these hinges need to be on the preset that gives limited rotation and no linear movement (i forget the proper name). you will want to change the range of rotation to ± the maximum steering lock that you want (so if you want a 35 degree steering lock you will want the lower limit to be -35 and the upper limit to be 35)
    this would need to be set as a motor with a reasonably low target velocity, because otherwise the wheels will snap to position very quickly. the motor settings could be driven by the left stick value.

    i cant go into more specifics than this yet because i'm still working on the engine and gearbox for my car, and havent touched the steering yet
    Share this post

  4. #4

    Re: Best way to steer a car?

    Originally Posted by Reaper392
    for a more realistic method you will want a rotation hinge for each front wheel. these hinges need to be on the preset that gives limited rotation and no linear movement (i forget the proper name). you will want to change the range of rotation to ± the maximum steering lock that you want (so if you want a 35 degree steering lock you will want the lower limit to be -35 and the upper limit to be 35)
    this would need to be set as a motor with a reasonably low target velocity, because otherwise the wheels will snap to position very quickly. the motor settings could be driven by the left stick value.

    I tried this the first day Evo was out (as a game developer i was naturally curious) and it doesnt work. You can create a physics joint that has 2 hinges, and you can limit one of those hinges for realistic steering perfectly. But heres where you run into problems, you cant actually control those two hinges separately through the motor. It will only power the 'main' hinge (the one that shows up red)

    So of course i though, ok so ill use the 'main' hinge for the steering, and the secondary hinge to allow the wheels to roll. But when you rotate the secondary hinge it also rotates the main hinge, so the angle of your steering spins with the tire, if that makes sense.

    So after that i decided to do the steering on a separate object, attach the wheels to that, and attach that object to the car. I got that working nearly perfect, but the physics in Trials Evo are kind of iffy, and the joints were incredibly sloppy and steering while driving was a nightmare because the tires would flop around and bounce so damn much. (yes i messed with the strength slider, and made sure all the linear movement, spings ect. were off)

    I only messed with making a car for about an hour or two, so i could very easily be missing something (and i hope i am, because id love to free roam in a legit car) but im thinking its not 'really' possible, at least not in a way that will feel very good.
    Share this post

  5. #5

    Re: Best way to steer a car?

    ah, i'd forgotten that double hinges wouldnt work, this could make life interesting. steering is next on my to do list so i'll take a good look at it when i'm next on
    Share this post

  6. #6
    T4KShadow's Avatar Senior Member
    Join Date
    Apr 2014
    Posts
    1,787

    Re: Best way to steer a car?

    I've decided to start new test to see if I can make a good turning car.

    It has been kind of successful, but now I'm stuck. Okay here's where I'm at;

    2 back wheels are powered by a motor (which is powered by RT value) and they work perfectly.

    2 front wheels are attached to a beam, which is connected to a rotation hinge and a motor (which is powered by left/right on left stick). Anyway when I press left the wheels turn and point right, and vice versa. How do I resolve this?

    and that wasn't the question I was intending to ask. Now I can steer how do I make the wheels rotate? They don't even need to be powered (the back wheels can do that), just as long as they can rotate and roll. At the minute they're just static and this is preventing me from actually turning at all.
    Share this post

  7. #7

    Re: Best way to steer a car?

    So i need to say this...

    Everytime i refresh my page or click on view active topics and see this up here i always think it says: Best way to STEAL a car

    Its just bugging me and i had to say it
    Share this post

  8. #8

    Re: Best way to steer a car?

    the backwards steering issue is easily fixed. just multiply whatever is controlling the steering (i assume the left stick horizontal value) by -1

    the steering could be more problematic. the only way i can think to do that would be to have a freewheeling rotation hinge attached to a dummy object, and connect a limited rotation hinge between the dummy object and the car to control the steering.
    Share this post

  9. #9

    Re: Best way to steer a car?

    Reversing the value to minus works with everything for me, like a value of 2 would make it go one direction and -2 the exact opposite. But this was with Divide so the value could be much higher for you if using multiply.
    Share this post

  10. #10

    Re: Best way to steer a car?

    Originally Posted by Reaper392
    the backwards steering issue is easily fixed. just multiply whatever is controlling the steering (i assume the left stick horizontal value) by -1

    the steering could be more problematic. the only way i can think to do that would be to have a freewheeling rotation hinge attached to a dummy object, and connect a limited rotation hinge between the dummy object and the car to control the steering.

    a couple posts up i said i tried this. The physics in trials evo cant take it, its incredibly sloppy and bouncy
    Share this post