Xkynar
Xkynar

Reputation: 955

Box2D Raycast fraction is never zero?

Im trying to raycast from the bottom of a box downwards. When the box is in the floor, I'd imagine the raycast fraction value would be zero, but it always gives me 0.0149998665. To be honest, It is not logic-breaking at all, but it OCD's me alot, and I'm just wondering why this happens?

Added a little sketch to make it easier to visualize:

enter image description here

Upvotes: 0

Views: 292

Answers (1)

iforce2d
iforce2d

Reputation: 8262

Polygons (and edges) in Box2D are kept at a tiny distance apart to help stability in the contact constraint solver. http://www.iforce2d.net/b2dtut/gotchas#smallgap

Upvotes: 1

Related Questions