Sign in to follow this  
Ghost Clock

Opinions: Overlap vs Gap

Recommended Posts

I'd like to get some opinions on something that I'm pretty sure is just me being an overly picky perfectionist. I have a tank and a block that are in real world terms, "touching". My collision code (which is not going to be altered unless it can't be helped) is pretty accurate most of the time but some innaccuracy is inevitable (floating point values and all that). So with that, which would be better in the rare instance where the accuracy isn't perfect? Overlap:
[img]http://s8.postimage.org/fbkbr84cz/overlap.jpg[/img]
or Gap:
[img]http://s10.postimage.org/aejkl2r1j/gap.jpg[/img]

Remember, in both of these pictures, the block and tank are touching, right next to each other. With the extra gap data added to the collision data of each object, there shouldn't ever be any overlap but there will also always be a gap between objects 99% of the time. Without the gap data added, overlapping will happen some times but most of the time it'll look dead on.

Getting the gap data is also a bit of extra work where as getting the default data is all but automated.

I'm not making a game about rubbing tanks up against walls, so I have doubts anyone will even notice but that little voice in the back of my head won't shut up until I get a few opinions on what others think would be preferable. Personally, they both bug me equally.

Share this post


Link to post
Share on other sites
In my opinion, the gap would be better, unless you are pushing blocks and seeing the block move with a gap between the thing pushing it and the block being pushed.

Why not say, "If A is inside B, set A's left edge to be equal to B's right edge"? Edited by Servant of the Lord

Share this post


Link to post
Share on other sites
[quote name='Servant of the Lord' timestamp='1343506541' post='4964082']
In my opinion, the gap would be better, unless you are pushing blocks and seeing the block move with a gap between the thing pushing it and the block being pushed.[/quote]
That's a really good point to think about. Not the case as it happens but I'll keep that in mind if I end up reusing this code for such a mechanic.

[quote]Why not say, "If A is inside B, set A's left edge to be equal to B's right edge"?
[/quote]
I don't have a good short answer to that and would struggle to explain it in detail. I get what you're saying though, I've used such a method before but it wouldn't be ideal to make work with my current collision check methods.

Share this post


Link to post
Share on other sites

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