Colliding with shapeVector
by Jason Booth · in Torque Game Builder · 02/09/2006 (12:17 am) · 5 replies
Hmm.. I have a sprite which collides with a shape vector. More specifically, a terrain made of lots of shape vectors (think 100 colums each sloped to match up seemlessly). The problem is that after a small amount of occilation, the sprite basically gets tossed to the world limit instead of resting on the ground correctly. Now, I'd imagine that some of this might be caused by the number of shapes it's colliding against, but it seems as if there should be some way to set this up to work. Anyone have any ideas?
About the author
#2
My original terrain code constructed the verticies in range between 0.2 and 0.8 on the y axis. The bottom of the terrain was at 1. This ment that the center point of the object was always outside of the collision poly, which seems to give t2d no end of trouble. Once I switched my code to generate the terrain from -0.2 to -0.8, everything started working much better.
I still occationally get an object being tossed around when my machine stalls, but for now it's good enough to continue work.
02/15/2006 (9:11 am)
Hey chris; I figured out what was causing this problem after a few frustrating nights; I believe it's a bug in torque. My original terrain code constructed the verticies in range between 0.2 and 0.8 on the y axis. The bottom of the terrain was at 1. This ment that the center point of the object was always outside of the collision poly, which seems to give t2d no end of trouble. Once I switched my code to generate the terrain from -0.2 to -0.8, everything started working much better.
I still occationally get an object being tossed around when my machine stalls, but for now it's good enough to continue work.
#3
02/15/2006 (9:17 am)
Jason - Do you have a video of it working? I'd like to see the problem... and mostly, I'd like to see your cool code in action ;)
#4
02/15/2006 (3:23 pm)
I can send you an example file created in the level editor if you'd like, and I actually posted two versions of the landscape code in another thread (one with the problem, one without)..
#5
02/15/2006 (3:37 pm)
Hows about a couple screenies ?
Torque Owner Chris Labombard
Premium Preferred
Are these procedurally generated terrains? I don't know how T2D's collision system works but perhaps you can add an additional type that can do a collision check using the set of equations used to generate the terrain. Of course you'll have to take into account any deformations you create.
It's not an easy solution, but it might work with if you have the code skills to implement it.