I’m pretty new to raycasting but can you tell me what did i do wrong?
The monster turns red when the ray hits the object. It works. But when i put a temporary object in between it still turned red…
this is the event.
in game.
Do i need to add like an event to trigger it or a behavior…?
PLS tell me if you know.
hello!
raycast only takes in account instances of 1 object (the one that you put in raycast conditions) because that is the most performance friendly (and also it makes sense, if you have a floor for example, you dont want it to hit the floor)
this means that raycast see through everything, until it hits what was checked for.
if you want it to ram into walls, you must put the player and the wall in an object group. and use that object group.
however, doing that would make the monster go red even if it hits a wall. to prevent that, you must further check what did the ray checked: