Game Development Community

Curved Ground Surfaces

by Drew Robson · in Torque Game Builder · 12/08/2007 (5:27 pm) · 8 replies

Can TGB do this:

A platformer with the ground as a curved or undulating surface. Since collision detection has to be convex, is TGB limited to square/angled level design? Would CUSTOM collision detection provide a way to get around this? Could a bezier solution to the collision poly work for this?

If too much engine work needs to be done I think TorqueX might be a better solution.

Thanks.

#1
12/08/2007 (6:40 pm)
Slopes and curved platforms are definately possible, all it is is basic maths.

No engine mods needed.
#2
12/09/2007 (8:07 pm)
Thanks for the response. However, it doesn't explain how I would get around the convex collision surface limitation without getting into the engine.
#3
12/09/2007 (8:45 pm)
You can work around this limitation easily by making multiple collision objects for the floor, instead of only one. This is what I do and it works.
#4
06/11/2008 (11:19 am)
Yeah, I have done the same thing. I have a concave slope, think of a crater in the ground. I created the two sides of the crater, then created the "bowl" of it by making squares of the same color at 10 degree increments. It works pretty good, however there seems to be a problem with the physics engine where it gets hung up on corners and joints. Thus making something in this way increases the chance your object is going to get stuck.
I believe the reason that you cannot do concave shapes is because it's hell on the collision detection algorithm. Since the pysics would need to take into account the full shape it would be a problem for speed in some games.
#5
06/14/2008 (12:00 am)
As a follow up, here is a link to my blog which has a small post showing pictures of how to do this.. or how I did it anyways. http://carpetscooter.blogspot.com/
#6
06/14/2008 (7:00 am)
Hi Nic, it's a pretty decent solution, thanks for the images. I've changed to Farseer in TorqueX for its concave collision however.
#7
06/16/2008 (12:03 pm)
I Haven't used Farseer. Looks like a pretty cool add-on. I am not using torqueX. You think it would work for somebody using plain-old TGB? I'm having some problems with collsion stickyness.. and unsettling objects.. they never seem to actually settle... anyways I might consider using something like that in the near future.
#8
06/16/2008 (5:18 pm)
Farseer is a C# implementation, although it has been ported to BlitzMax. I suppose you could also import it as a DLL to TGB for an in-parallel windows only solution. Chipmunk or Box2D would be better for a C++ integration.