So… To put it simply, I lower the trace box extended into the distance down and at an angle so that it touches straight surfaces only with its far edge. (This is how I find the farthest impact point).
But the impact points that I get when tracing onto a landscape look… suspicious… Just scrolling around the axis I should get a circle, but what I get are suspicious squares. (Pink spheres are impact points).
Moreover, if I do the same on a regular platform, then everything looks acceptable.
Does anyone have any ideas on how to fix this?
I don’t know the reason, but I’ve encountered the same thing. The “impact point” of the box trace appears to snap to the landscape’s gridlines when the trace is done at certain distances and angles. I can see the same thing in your example where the errant points are on the landscape gridlines. Given this, I’m guessing it’s some kind of rounding error in the engine’s collision detection with landscapes.
I don’t have a good solution but this is what I’ve found:
Longer tracing distances (distance between the set start and end) will lead to more error. The only difference between the images below is the distance the trace is set to check. The longer trace errors out and clamps to the landscape gridline. (Magenta debug point is the impact point)
Interestingly, the error only really appears when the actual hit distance is very close to the start point of the trace. In these pictures the tracing distance is the same, but the distance from the ground is different.
This behavior may be proportional to the largest component of the “half size” parameter of the box trace. These pictures show the minimum distance between the trace start and a hit that an error will appear given a certain half-size. Trace distance is the same.
So given these findings, my suggestions would be:
- Minimize your tracing distance as much as possible, ideally setting it to be just enough to reach the ground your character is standing on.
- Keep the size of your box as small as possible.
If these don’t get you to where you need to be, then you may need to look into another way to figure out the trace information you are looking for, or explore a different landscape solution.
Good luck!
1 Like