❔ My Raycast seems to be upside down
Hello, the debug log return my prefab, however this prefab is the start point of my raycast ? How is it possible and how to resolve it please ?
15 Replies
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/the raycast hits the collider of your object probably
How could I fix that?
And how is it possible since that the object is the entry point ?
well if you shoot it from within the collider logically it would hit the collider
colliders are volumes rather than surfaces
but I precised that only some layers should be triggered
ah i see your error
the raycast takes a layer mask not the layer index
do a bitshift
1 << layerIndex
I don't remember actually, you may need to invert it too
~(1 << layerIndex)
this one doesnt change anything
this one set the drawray to red, but when I hit the layer that I want to target, it stay to red
"it stay to red"?
that's not english, can you word it differently?
sorry Im french
the color of the layer is red
even when I hit the layer in question
so?
so the hit.collider always stays to null
there's no code that would change it
you probably meant to do the raycast in update
awake only runs once
its a old code
I change the layer index to the layer mask
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.