Acceleration and steering not working properly on vehicle body

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By iuripugliero

Hello there guys
I’ve been trying to make a bike work for a 3D infinite runner. Thing is, when I hold accelerate it moves really slow (constantly stucking like if it was with 7~10 fps). With fraps I got 60 fps, so it is not fps problem. When I release the accelerate button, however, all the acceleration it got while I was holding, is instantly released too, so it moves like it should have been since the key was hit. Other thing I have noticed is that the wheel of the bike only move properly when the accelerate is released and is steering for one side. Steering to the other makes the wheel rotate, but, reversed.
This is my code:

Thank you

I believe the problem might be in the programming. When you set an engine force, you can multiply that sum by a number to get a stronger value, otherwise, I’ve come to notice it leaves a very weak acceleration force.

Here is some simple code you can use just to move forward and backward and steer left and right:

func _physics_process(_delta):
steering = Input.get_axis(“ui_left”, “ui_right”) * 0.4 #sets the steering on axis between the left and right arrows
engine_force = Input.get_axis(“ui_up”, “ui_down”) * 100 #sets the engine force on an axis between the up and down arrows.

You’ll see I multiplied the engine force by 100. This is so that the engine force will have more acceleration when moving. Without this, you are most likely going to be really slow.
The reason why I’ve multiplied the steering by 40% is so that it will not be just really slow when turning and will be really sharp at turning. By doing this, I slightly balanced it a bit so it’s not as sharp at turning but it will be a bit quicker. The lower you set this, the faster at turning but your turn isn’t as sharp.

matt-724 | 2023-01-23 22:57