Sign in to follow this  

Collision detection on cubes.

This topic is 4543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone! I'm working on a 3-dimensional tetris, but I've got some problem with how to check if two cubes have collided. The reason is that I want to check if they collide even when they're rotated. I could probably write some function to check two normal cubes, but when you rotate one or both of the cubes I'm completely lost. I've tried googling around a bit, but I can't seem to find anything relevant. So if anyone could push, kick or throw me in the right direction I'd be really grateful.

Share this post


Link to post
Share on other sites
For tetris you want your cubes to either hit or miss, rather than rotate through 45 degrees, just touch the corner, and roll off, yes? So there isn't actually a great deal of physics involved. Can I also assume that by "rotated" you dont mean the cube is rotated, you mean there is a set of cubes which form a piece and the piece has been rotated? And that this rotation is always a multiple of 90 degrees around some axis?

I would be inclined to have a 3D array of on/off flags for the entire volume the piece can fill, and another such for the play area, and just check to see if two corresponding ones are set - one for each cube.

Share this post


Link to post
Share on other sites
No, by rotated I actually mean a 3D-cube that has been freely rotated. I'm trying to make a somewhat different tetris than the usual, so I want the player to freely rotate the cubes. But thanks for your reply anyways.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sounds interesting actually. Anyway, have you taken a look at http://www.tokamakphysics.com/? One of the demos is actually collapsible cubes (kind-of what you're talking about I think). I'll be honest though, I haven't actually tried this physics engine, but I heard some good things about it...

Share this post


Link to post
Share on other sites
jyk, thanks for the suggestion. I'll take a look at that, seems like it's what I need. Thanks for your suggestion also AP, but I'm not really interested in a physics engine. Seems like a bit of overkill [smile]. A bit offtopic though, how come an AP has a user rating? I've never noticed that before.

Share this post


Link to post
Share on other sites
Regarding physics engines, I'm just testing a few (Novodex, Newton, Tokamak, ODE) and I found Tokamak to be the most straightforward to use. A physics based Tetris-style game actually sounds like an interesting idea.

Share this post


Link to post
Share on other sites

This topic is 4543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this