0 votes

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:

https://pastebin.com/ynNkVmKh

Thank you

in Engine by (28 points)

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 physicsprocess(delta):
steering = Input.get
axis("uileft", "uiright") * 0.4 #sets the steering on axis between the left and right arrows
engineforce = Input.getaxis("uiup", "uidown") * 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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.