Hi! I'm a student, and I was wondering if someone would be able to help me with my project. Basically, I have difficulty using a BoxCast. I need to make a pathfinding algorithm and I start by creating a bunch of navPoint around the map. Then, I want each point to have a list of the navpoints around it (in front, behind, on the sides and on the diagonales). I want to use a boxCast as there's a variable which I use to know how high a point can see, so if there's steps, a point can connect with the one above until a certain height. I managed to make it work on a side project, but when I use the same code in my main, it does nothing. I'll send a screen of my world and the part of my code dealing with the boxCast. If someone thinks they can help me, please feel free to try. If you need more details about my code or how I did it, don't hesitate to ask ^^
#BoxCast
1 messages · Page 1 of 1 (latest)
"does nothing" doesn't tell us very much..
does the code run at all?
what's getting logged?
Sorry, it's the first time I ask for help. I agree I should have been more precise about this.
Basically, each point has a list with its connection. Though, nothing gets added to that list. I actually did just add the debug logs. The final one in the code writes "RIEN" which the french version of "nothing", nothing has been detected.
When I run my code, it doesnt do nothing, I should not have said that, but it does log "nothing". 8 times the amount of points to be precise, so it tried every directions with each point, and actually finds nothing.
I thought it had to do with the layers, but then I added that I want it to log the name of any object it may detect, even if it's not a point. Though, I changed the layers for it to only work with other points, but I wanted to be sure.
It's the first time I use BoxCast, I'm unsure on if I did it properly, even if I looked at the Unity website to use as a model.
Is it better? ^^'
Yes, that's more helpful.
Is the box's Y size non-zero? The default value for dénivelé is zero.
ah, you set it to 10, ok
I believe BoxCast will ignore any colliders it starts inside of, so that could prevent it from hitting some colliders.
What version of Unity are you using?
Yeah, I tried putting huge values for all sizes of the box to make sure its not because its too small
If it is new enough, you can turn on the Physics Debugger to see what the queries are doing
2021.3.17f1
I could have seen the casts? That would have been so helpful
There doesn't seem to be that option.
So it seems you're right.
ah, was it zero
Yes
I was going to suggest using Debug.DrawRay to see how far the casts were going
that may still be useful
Thank you ^^