Raycasting with oneway collisions

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

I have an enemy casting a ray towards the player to check if it can see the player.
In my tilemap there is an tile with oneway collision but the raycast dont respect oneway collisions. Is there a feature for raycasting with oneway collision?
I am using the intersect_ray function not the raycast node.

:bust_in_silhouette: Reply From: jgodfrey

While I’ve never used intersect_ray(), the docs mention a number of ways that objects can be ignored by the raycast. I’d assume one of them can be made to work for your case…

Additionally, the method can take an exclude array of objects or RIDs that are to be excluded from collisions, a collision_mask bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with PhysicsBodys or Areas, respectively.

I’m not aware of any way to specifically ignore one-way collisions using intersect_ray()

Docs are here:


The problem is that in all cases the “object” is the tilemap. But i only want my oneway tile to be ignored and i only have one tilemap.

RoniPerson | 2020-07-11 18:18