![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Langrisser |
Hi,
I’m using KinematicBody2D to collide with several other KinematicBody2D and StaticBody2D. The problem is when the object collides with one object, be it other kinematic or static, it won’t register another collides from other objects.
I’m moving kinematic with move_and_slide() and using get_slide_count() together with get_slide_collision() to get the collisions (which I assume a way to get all the collision happens to this kinematic)
for i in get_slide_count():
var collision = get_slide_collision(i)
print("Collided with: ", collision.collider.name)
The result is get_slide_count() never returns a value greater than 1 (either return 0 or 1) even when all the objects hitting each other.
I tried to search for a way a KinematicBody2D to get all the collisions that happen but there’s no specific tutorial for this, all that I find just collide and done
Is my assumption is wrong, or is there another class that handles kinematic collision?
a link or a pointer to solve or discussing my problem is much appreciated!
According to the documentation, it will only register collisions with RigidBody2D
and other KineticBody2D
s, not StaticBody2D
. I’m not sure if that will help or not, but if is colliding with StaticBody2D
nodes and you’re not getting anything back for it, that might be why.
Eric Ellingson | 2019-11-06 02:56
Hi,
I tried to collide it with other KinematicBody2D but still, get_slide_count() only return 1 when visually it should hit 2 other kinematics.
I’m starting to think it’s a bug…
Langrisser | 2019-11-06 09:09
before colliding:
Imgur: The magic of the Internet
after colliding:
Imgur: The magic of the Internet
The white number on top is get_slide_count()
value
Langrisser | 2019-11-06 09:19