Uploaded April 2024 | Updated September 2026, 3 weeks ago
Watch the stream here:
twitch.tv/aarimous
#shorts #godot #aarimous
Godot Docs for PhysicsBody2D.move_and_collide:
docs.godotengine.org/en/stable/classes/class_physicsbody2d.html#class-physicsbody2d-method-move-and-collide
Note: I am setting test_only = true in my function call as I want to only test if a collision would occurred if the character moved in the mining direction. You may need to play with your motion vector to get this to work as desired. If you need more help, feel free to stop by my Twitch stream so I can help you out.
Godot Docs for KinematicCollision2D.get_collider_rid:
docs.godotengine.org/en/stable/classes/class_kinematiccollision2d.html#class-kinematiccollision2d-method-get-collider-rid
You can then use the Tilemap.get_coords_for_body_rid() to get the cell for the RID which you collided with. Then at that point you have the exact cell for and can do your own logic on the sell.
Docs for Tilemap.get_coords_for_body_rid():
Tilemap.https://docs.godotengine.org/en/stable/classes/class_tilemap.html#class-tilemap-method-get-coords-for-body-rid
Watch the stream here:
twitch.tv/aarimous
#shorts #godot #aarimous
Godot Docs for PhysicsBody2D.move_and_collide:
docs.godotengine.org/en/stable/classes/class_physicsbody2d.html#class-physicsbody2d-method-move-and-collide
Note: I am setting test_only = true in my function call as I want to only test if a collision would occurred if the character moved in the mining direction. You may need to play with your motion vector to get this to work as desired. If you need more help, feel free to stop by my Twitch stream so I can help you out.
Godot Docs for KinematicCollision2D.get_collider_rid:
docs.godotengine.org/en/stable/classes/class_kinematiccollision2d.html#class-kinematiccollision2d-method-get-collider-rid
You can then use the Tilemap.get_coords_for_body_rid() to get the cell for the RID which you collided with. Then at that point you have the exact cell for and can do your own logic on the sell.
Docs for Tilemap.get_coords_for_body_rid():
Tilemap.https://docs.godotengine.org/en/stable/classes/class_tilemap.html#class-tilemap-method-get-coords-for-body-rid










