Game Development Community

Single Poly Convex ?

by Eric Roberts · in Torque Game Engine · 03/11/2006 (2:55 pm) · 6 replies

I've been recently playing around with implementing a convex shape that's a single polygon.

I'm only interested in player collisions so I've written my dervied convex class only overriding the getPolyList function and using the default getBoundingBox provided by Convex (and setting the mObject member appropriately).


The problem:

I have this single angled polygon in the game. If the player goes too fast to collide with it - the player won't collide. If player moves slowly, the player will collide with it. The player can even climb it's slope if the player moves slowly enough, and jumping to "push" the player up helps too.

So it works, but not exactly.


What I have done:

I've read through the player updatePos() function to look for any convex/velocity specifics which could explain my problem but with no success.


Additional Question:

I'm curious as to why other convexes like, say, the terrain which seems to work on a very similar scheme doesn't have this problem - but my convex does.


Any help is appreciated in advance.

Thanks,

- Eric

#1
03/11/2006 (3:59 pm)
A Single polygon collision shape won't work well, they need to be a closed shape to work properly.
#2
03/11/2006 (4:19 pm)
Could you explain why? If I made a thin convex enclosing the poly would it make a difference? Why does it sort of work - but not really?

- Eric
#3
03/11/2006 (6:47 pm)
I'm not really sure why, but I think just having the collision poly double sided (it would then be two polys) would probably help.
#4
03/11/2006 (7:17 pm)
I'm pretty sure when you buildPolyList - you can't "double side" a poly (look at any buildPolyList method). A poly is a poly - from both sides.

- Eric
#5
03/12/2006 (8:57 am)
The thin convex may work up to a point but there are precision issues and implementation you are fighting against. Having a closed shape allows for testing for the 'interior' of an object, convex shapes allow this to happen quickly and easily. The GJK algorithm used to calculate collisions/interiors for convex objects will not return accurate info on thin/small objects as it is currently implemented: it is currently implemented to test for vehicle and other larger shape items >1m per side.

Explain what exactly you are trying to accomplish, there may be a good workaround someone can provide.
#6
03/12/2006 (11:58 am)
@Jameson:

Thanks, that actually cleared a lot of things up for me. I didn't know that it should be a completely enclosed convex in order for collision to be more accurate. I was originally testing my object using a thin (0.002 units wide) box convex, and that worked much better my current single poly convex. But since it was so thin I thought I could get away with only having one poly to return from getPolyList.

I'll enclose the poly in a closed convex shape by a small amount and see where it goes from there. I'll test it when I grab some time and post it here when I get the results.

Thanks,

- Eric