Jump to content

[ANSWERED] How to avoid trigger collider been detected by raycast


Recommended Posts

I just notice a bug between my ACA mod and BDarmory. The gun in BDarmory using raycast and will hit the trigger collider, which means the huge trigger collider of my OLS will block all the incoming bullet, cannon.

Since the trigger collider might be the cheapest method to detect an area entering, is there a way for me to avoid the raycast and still working with other part?

 

 

Edited by flywlyx
Link to comment
Share on other sites

18 minutes ago, sarbian said:

Change the layer mask you use for the raycast to no include the layer used by  the trigger collider

My condition is kind of reversed, the layer mask of BDA is 557057, so it means if I put the trigger to layer 21 I will be safe?

And also, does the layer of the trigger affect which object trigger can detect?

Thanks for you help.

Link to comment
Share on other sites

  1. Don't use magic numbers in your code, use something like (1 << 0) | (1 << 15) | (1 << 19) , use a const with a proper comment or build a variable with a couple of LayerMask.NameToLayer ("layerX"). This way you know what you are actually checking.
  2. Yes, since your 557057 should be layer 0, 15 and 19 if your trigger is on 21 you will not collide with it. But you should check what 21 is used for with a LayerMask.LayerToName(21) (I don't have the info at hand)
Link to comment
Share on other sites

3 hours ago, sarbian said:
  1. Don't use magic numbers in your code, use something like (1 << 0) | (1 << 15) | (1 << 19) , use a const with a proper comment or build a variable with a couple of LayerMask.NameToLayer ("layerX"). This way you know what you are actually checking.
  2. Yes, since your 557057 should be layer 0, 15 and 19 if your trigger is on 21 you will not collide with it. But you should check what 21 is used for with a LayerMask.LayerToName(21) (I don't have the info at hand)

Layer 21 is for Trigger collider like ladder and hatch, I think this is a perfect fit.

Thank you for your answer!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...