![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | unrealidiot |
Hello,
I’m trying to create 2D side scroller vehicle game and I’m having difficulties with the physics.
I would like my vehicle to move at a selected speed (like cruise control). I have managed to get the vehicle to move left and right and everything works as expected except when it comes to going up hills. The wheels slip almost as if there was not friction.
Can someone shed some light on how to go about solving this issue.
Please see this video to see what I mean: https://www.youtube.com/watch?v=vi-8fJiUxSU
How is “moving left/right” defined in your code? It should be defined as “towards the front/back of the vehicle” (i.e. the force vector should point upwards / downwards depending on the rotation of the vehicle). If you just try to move straight to the left / the right, this would explain the behaviour seen in the video.
Thomas Karcher | 2019-06-13 13:35
I forgot to specify that. I’m doing the following:
for wheel in wheels:
wheel.set_angular_velocity(wp_current)
wp_current is just some value I increase depending on desired target speed.
wheels is a node containing children rigid bodies (the wheels)
unrealidiot | 2019-06-14 00:41
Did you set friction = 1
and rough = true
in the physics material properties of both your wheels and the surface? (Assuming you’re using Godot 3.1)
Thomas Karcher | 2019-06-14 05:48
I have. For the terrain I’m using a tilemap. I will test with a static body and see what happens.
unrealidiot | 2019-06-16 22:38
I tried using static body and rough = 1 and friction = 1 and same result, the wheels keep on spinning.
unrealidiot | 2019-06-20 01:00