#collider not hold to navmeshagent
1 messages · Page 1 of 1 (latest)
Logging with gui is fine but log those necessary data
yes but look
Instead of the less valuable "1, 2, 3, 4"
when trying to raycast at npc im getting 0 on gui
meaning im not even hitting it so i have no data
and im 90% sure its fault of layermask
both default and pickup are pre defined ones
but npc is one i made
and is only used for this if
Do you know how to use GetMask?
i did get multiple masks
You don't + the bitmask.
but since these are 0101 string they seem to work together no?
how else i can merge these 3 masks then
|
||? so i have to run 3 raycasts at once?
bit or | is different from ||
so LayerMask.GetMask("Default") | LayerMask.GetMask("Pickup") | LayerMask.GetMask("npc")
And beside you can pass multiple layer names to GetMask
LayerMask.GetMask("Default", "Pickup", "npc") is fine
Log the result if you're unsure (that of those results and what you're expecting)
If layer name is correct, 🙂
We've heard that but it's best to go into this assuming everything can go wrong.
Ensure the layer detection is correct.
Ensure the ttt vector is as expected (a certain value).
At specific values of ttt, ensure it's entering the specific conditional branch (if statement).
i dont get any vector in game
If all of this works in all cases then your issue will naturally resolve itself.
It's future suggestions
You ought to be mainly concerned about layers for now
Did the rest cast hit anything?
What did the ray cast hit (name)
i used this and still dont detect npc
Does it have the necessary components
Stop using those numbers as debugging info
Can you share your layer settings
Pretty sure it's common debugging 101 to log valued data ie layer being tested against, name of other object, collider, etc.
These should not be assumed.
So instead of logging 0, log what zero was supposed to verify.
that player actually clicks
Log why it's zero
raycast run on cliick
should i flick everything on in npc tab to check if raycast work then
ah what should i add here
Instead of assuming there's no collider on the other object etc
Why not log the components of the ray cast to see if they're what you're expecting?
When I say log, I mean so with your text output
As you're not able to do so with Debug.Log in your build.
i can in unity
but in unity everything works
just in game it doesnt
so i log on gui instead
Basically, figure out why it's zero.
Look at the parts of the ray cast and check if they're what's expected - likely not.
on pc
Check if the other object is really at the correct location.
You're going to have to debug this as I can't do it for you.
My advice is "lot's of logs" or appended strings to be set to the text in your case.
What you and I see isn't what the computer sees. You need to see what the computer sees.
And see why it isn't seeing what you're seeing.
Trying to be clever and assume we know what the computer sees is the wrong approach. Just ask the computer what it sees till you figure out how to see it's way and make it see your way.
ok it work now
i switched to different layer
prebuilt layer
so i was right that game only detects prebuilt layers
So why?
Log the non prebuilt layer and see what's the value. See why it's not liking it.
i remember somebody said that game doesnt log names of the layers only numbers
so maybe if i would use layermask from number it would work
Not sure what you're saying but layers are just bit masks
They're all numbers ultimately
Instead of guessing log what the computer sees
they say it doesnt log this name
only its value
so i would have make bit mask from int
Logging binary is fine as we can all read binary?
I don't believe so
well that what they said
You're likely misunderstanding stuff
so how would bit mask out of numbers look like
for default pickup and npc
"A" = 0001
"B" = 0010
```Logging `A | B` will not give you a valid name but it'll definitely give you a value.
In my case A | B would give you 3 or rather 0011
nono i wanted replace getmask to use int instead of string
More variables and rooms for mistake
i need test that as that what they talked about to not use strings with layermasks
Good luck experimenting with bit masks
it does work on reserved layer so its not reading my custom layer
probably because it not included in raycast
that why it dont even log 1
That's a lot of assumptions
don't need to guess if you use debug.logs with relevant contents 😄
Prove it all. But just to be clear, you're better off seeing what the computer sees and work from bottom up instead of assuming stuff. Seeing the flow isn't enough, you need to see exactly what it's seeing/reading/evaluating.
troubleshooting is half guessing half testing - a theory + solution is prone to x-y problems - prove your theory first
before trying to fix it
an x-y problem is when you misinterpret the cause of the problem and try and solve it anyways
My interpretation: Prove that is not reading your custom layer before using some other layer solution. ie What is your custom layer's value? What's it being evaluated against? Why raycast doesn't like it.
I bet his attention is lost, having solved the "problem" 😛
no it was actual thing