box collision
box collision
Does the minetest lua api have a built in function to quickly and efficiently check if two boxes intersect given minp an maxp for each?
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: box collision
Not that I know of, but the algorithm is pretty easy. If you Google cube-cube collision, you'll find this:
Code: Select all
return (A.min.x <= B.max.x) &&
(A.max.x >= B.min.x) &&
(A.min.y <= B.max.y) &&
(A.max.y >= B.min.y) &&
(A.min.z <= B.max.z) &&
(A.max.z >= B.min.z);
Re: box collision
I was just wondering if there was a super fast implementation, since I seem to be doing a lot of this. :)
But, the old fashioned way is pretty fast in lua, I guess I'll stick to it.
thank you
But, the old fashioned way is pretty fast in lua, I guess I'll stick to it.
thank you
Who is online
Users browsing this forum: No registered users and 10 guests