Skip to main content
gamedev.net
🔒 Locked

segment in cube

Started by Daivuk 0 replies 500+ views
Original Post
Daivuk
Daivuk
Is there a simple way to know if a segment intersec with a cube? Or i have to do intersection for all face of the cube? thx
Cedric
Cedric
quote:
Original post by Daivuk
Is there a simple way to know if a segment intersec with a cube? Or i have to do intersection for all face of the cube?

AFAIK, yes. Doing a bounding sphere test first will eliminate a lot of cases, though. If you''re worried about performance, you might also want to transform the segment into the model space of your cube. I''ve never compared the performance of doing that vs doing straight segment-to-plane collision.

There are a lot of other optimizations to consider, of course.

Cédric

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.