0 votes


I'm trying to do a top-down mini golf game to learn the Godot engine. So the question is that how to rotate KinematicBody precisely so that it collides the ball every time. Now it collides only when the rotation speed is low enough. With higher speeds, it goes through.

If I understand the physics engine right it doesn't recognize the collision because the stick clips inside the ball between frames. So the question is how this should be done? I didn't figure out how move_and_collide() would help me in this situation because I'm not moving the stick. I'm just rotating it so it can hit the ball. Here's a pic from the side angle if it helps

And here is the current code. I tried to do the same with rotate_object_local() without success.

extends KinematicBody

var mousePos = Vector2()

func _physics_process(delta):
    mousePos = Vector2()
    transform = transform.orthonormalized()

func _input(event):
    if event is InputEventMouseMotion:
        mousePos = event.relative
in Engine by (15 points)

1 Answer

+2 votes
Best answer

Try not to rely on the physics engine too much like this. I'm not saying the physics aren't capable but in this circumstance using applycentralimpulse on the ball triggered by an area body_entered signal or timer will suffice and everything else like the stick is just visual.

by (3,219 points)
selected by


thanks for the answer! I will try to use that workaround and I'm pretty sure it will work. I have to say that initially, I was looking for some physics-based solution as the problem seems pretty simple (or is it?). This type of solution might come handy in other collision situations too so thanks for that!

The only physics based solution would be to increase the physics fps but this would slow everything down except node's using methods that directly set their position like Translate()

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.