Strange results with Simulation.Sweep #304
Unanswered
GlaireDaggers
asked this question in
Q&A
Replies: 2 comments
-
(At a conference and probably won't be able to respond for a few days, but I've seen this and intend to respond eventually!) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Still traveling, but somewhat less swamped: could you provide a minimal repro that demonstrates the behavior in the demos? Maybe a modification to the SweepDemo? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I am writing a game engine which uses BEPU as the main physics engine.
One thing I'm working on is a collide-and-slide character controller. I am attempting to implement this by performing iterative sweep tests with a capsule shape.
I was dealing with some issues where some sweeps aren't hitting some things even though it really seems like they should. I ended up narrowing down the issue to the value I pass for maximumT.
To show you what I mean, here's a little test I whipped up:
The "Test Shapecast" window lets me set the origin of the shapecast, a delta to sweep it along, and a maximum distance. The delta gets normalized before it's passed to BEPU (so in this case what BEPU gets is a direction of [-1.0, 0.0, 0.0] and a maximumT of 0.1), but I use its length pre-normalization to reject the hit if the closest distance is farther than the delta. The logic looks like this:
(note that the _physics.CapsuleCast is just a wrapper around Simulation.Sweep - it constructs a sweep handler that stores the nearest hit in a RaycastHit structure and returns true if it hits anything)
In that example above, despite clearly intersecting with my lamp post's collision mesh, it does not detect anything. However, if I instead increase max distance, it detects the hit:
(in fact it seems like somewere between 0.13 and 0.14 is where it starts detecting the collision)
What's going on here? How come manually filtering out hits above a certain distance works, but passing that same distance to BEPU makes it fail to detect anything? Would greatly appreciate some insight into this, as it was giving me quite the headache when trying to debug my character physics!
Beta Was this translation helpful? Give feedback.
All reactions