0 votes

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.

asked Jul 11 in Engine by RoniPerson (25 points)

1 Answer

0 votes

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:

https://docs.godotengine.org/en/stable/classes/class_physics2ddirectspacestate.html#class-physics2ddirectspacestate-method-intersect-ray

answered Jul 11 by jgodfrey (6,576 points)

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.

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 How to use this Q&A? before posting your first questions.