Raytracing not working with tilemaps?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SuperMatCat24

I was trying to make a crawling script for my player and everything is working exept for the raycast. I have checked the collision mask and it is enabled, but the player still finishes crawling even though they are inside a block. Any way to fix?

This is my code for the crawling (Specifically where the raycast is used)

  func is_crawling(delta):
    	if Input.is_action_pressed("ui_down") or $CrawlCheck.is_colliding():
    		$AnimatedSprite.animation = "Crawl"
    		var shape = RectangleShape2D.new()
    		collisionshape2d.set_shape(shape)
    		collisionshape2d.position.y = 3
    		shape.set_extents(Vector2(2,1))

I looked online and theres a lot about it but none of the fixes have worked for me… Am i just doing something wrong?

SuperMatCat24 | 2023-01-22 09:45

:bust_in_silhouette: Reply From: SuperMatCat24

Sorry for bump but its rlly important for the game. Thanks