Forum rules - please read before posting.

Additional "Ignore Raycast" Layers

Hey!

Is it possible to add additional Ignore Raycast layers to the raycast settings of adeventure creator?

I have some cars moving around in my game which use triggers for spawning, big box collisions placed along the road where cars will spawn. I'm using the "Ignore Raycast" layer for the player character, and the cars are set up to stop when detecing a collider in that layer (so they don't run over the player character). Problem is, if i add the spawn triggers to "Ignore Raycast" layer, cars will stop when detecting a spawn point as well, basically stopping all the traffic in the middle of the road. When the spawn triggers are not on the Ignore Raycast layer however, they block the raycasts used to move the player around the navmesh and basically mess up navigation for the player character in my level.

Comments

  • I can only hazard a guess without seeing your script, but it sounds like it should be possible to keep things on Ignore Raycast if you perform an additional check that the detected collider is the Player.

    If you tag your Player character as e.g. "Player", then your car-stopping function can check if it's actually detecting the Player by comparing the detected hit's tag, e.g.:

    if (raycastHit.collider.CompareTag ("Player")) // Detected Player
    
  • Yes that would work but I'm trying to avoid modifying the traffic system since its an asset from the store and i'd like to keep it stock in case i need to update it later. My intentions were to just find out if there's an easy way to add more layers that i didn't knew about.

    But no worries, for now I've solved this issue by moving the player to a custom layer, moved the trigger to "Ignore Raycast", set the cars to ignore it and look for the custom layer for avoidance. Its a good enough solution and the least hassle with code changes and such.

    Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.