The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I made a small example with two balls that should collide together and bounce.
Sometimes the balls stay stucked together before being bounced.
I made a video of this:
And the code:

extends KinematicBody2D
export(Vector2) var velocity:Vector2=Vector2(500,0)
func _physics_process(delta):
    var collision_info=move_and_collide(velocity*delta)
    if collision_info:
in Engine by (24 points)

2 Answers

0 votes

That code works fine here. However, I can break it by scaling the bodies. If I set the body's scale to (1.1, 1.1) they "stick" before moving in a strange direction.

Collisions never work well with scaling. Keep your bodies at (1, 1) and scale the sprite and/or size the collision shape to match.

by (22,191 points)
0 votes

I manage to fix it by increasing the Safe Margin of the of the KinematicBody2D.

by (24 points)
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.