0 votes

I have been trying to build a motorbike racing game and have struggled with trying to use the 'Vehicle Body' and 'Wheel Body' and everything I have tried has not worked (the bike kept swaying like a boat on the ocean).

So I have moved onto using 'Kinematic Body'. The issue I am having hear is that the bike does not follow the road surface correctly

Image of Bike Issue

I have tried using two collision shapes, one for each wheel, however, the appears to be only using the rear wheel collision shape.

Any help would be greatly appreciated.

in Engine by (19 points)
edited by

I may be wrong, however with a KinematicBody, I believe the physics engine will not calculate how your body moves - it will just move in the direction you specify and identify collisions. Your code needs to handle those collision (for example a tyre contacting the road).

So, you will need to rotate the bike to align with the track. The getfloornormal method will give you the slope of the road at the last collision point. You might need to model each wheel as a Kinematic body to give you two touch points...?

This tutorial is really good

Thank you very much for the information and pointing me in the right direction.

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 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 webmaster@godotengine.org with your username.