Game Development Community

Collision RunAway

by Demolishun · in Torque Game Engine · 10/07/2006 (9:40 pm) · 2 replies

Okay, I have built up an object that uses collision from the vehicle code and shapebase. What I do not understand is why the collision goes nuts when I put two of my objects together, but remains calm and realistic when mixed with the wheeledvehicle. If I put my object next to another of my object this is what the profiler shows:
44.570   0.100      179          ClientProcess

 44.469   0.100      179            AdvanceClientTime

 44.261   2.047      334              AdvanceObjects

 29.171   7.384      668                GCI

  8.865   8.865   185881                  GETFEATURES

  5.285   5.285  1115286                  MemoryAlloc

  4.753   4.753  1115286                  MemoryFree

  2.885   2.885   185881                  COLLIDE

 12.749  12.740      668                FCS

  0.008   0.008     1221                  MemoryAlloc

  0.000   0.000        1                  MemoryFree

  0.246   0.246     3648                ContainerCastRay

  0.025   0.025     1002                SceneGraph_rezoneObject

  0.019   0.019     2139                MemoryAlloc

  0.005   0.005      914                MemoryFree

  0.108   0.108     1611              ContainerCastRay

  0.000   0.000        1              MemoryRealloc

  0.000   0.000        1                MemoryFree

  0.000   0.000        1                MemoryAlloc

  0.001   0.001       39            ContainerCastRay

  0.000   0.000        7            MemoryAlloc

  0.000   0.000        7            MemoryFree

 44.490   0.004      179          ServerProcess

 44.486   0.022      179            AdvanceServerTime

 44.464   2.356      334              AdvanceObjects

 29.088   7.342      668                GCI

  8.912   8.912   184601                  GETFEATURES

  5.274   5.274  1107606                  MemoryAlloc

  4.788   4.788  1107606                  MemoryFree

  2.773   2.773   184601                  COLLIDE

 12.614  12.605      668                FCS

  0.009   0.009     1219                  MemoryAlloc

  0.000   0.000        1                  MemoryFree

  0.355   0.355     5344                ContainerCastRay

  0.027   0.027     1002                SceneGraph_rezoneObject

  0.018   0.018     2226                MemoryAlloc

  0.006   0.006     1005                MemoryFree

GCI is getCollisionInfo and FCS is findClosestState. I just ripped these functions right out of the vehicle and shapebase code.

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67


#1
10/07/2006 (9:40 pm)
More:
Here is how it goes with my object inside a wheeledvehicle object:
4.246   0.018      345          ServerProcess

  4.228   0.046      345            AdvanceServerTime

  4.182   2.040      188              AdvanceObjects

  1.058   0.072      188                GCI

  0.738   0.738      380                  COLLIDE

  0.106   0.106      380                  GETFEATURES

  0.102   0.102     2280                  MemoryAlloc

  0.039   0.039     2280                  MemoryFree

  0.691   0.691     3008                ContainerCastRay

  0.341   0.341      188                FCS

  0.034   0.034      376                SceneGraph_rezoneObject

  0.011   0.011      376                MemoryAlloc

  0.008   0.008      376                MemoryFree

  3.845   0.602      345          ClientProcess

  3.240   0.504      345            AdvanceClientTime

  2.071   0.549      189              AdvanceObjects

  0.985   0.091      189                GCI

  0.714   0.714      381                  COLLIDE

  0.093   0.093      381                  GETFEATURES

  0.049   0.049     2286                  MemoryAlloc

  0.038   0.038     2286                  MemoryFree

  0.341   0.341      189                FCS

  0.170   0.170      784                ContainerCastRay

  0.013   0.013      378                SceneGraph_rezoneObject

  0.007   0.007      238                MemoryFree

  0.005   0.005      238                MemoryAlloc

  0.666   0.666     3105              ContainerCastRay

  0.003   0.003       45            ContainerCastRay

What I don't get is why it would just go nuts. I am guessing the CollisionStateList is just getting huge and never clears any collision states off the list. I just don't understand why it would get so huge with nearly identical code inside the wheeled vehicle code. My object just won't play nice with itself. Maybe it has a self loathing issue. : )
#2
10/08/2006 (8:18 pm)
Okay, this one is really strange. If you do not put your new convex type into the mType of your new object all hell breaks loose when you start colliding with an object of that type if you are that type. Really strange and bizzare, but if you find yourself in that position then this was the fix. Yet another example of forgetting to intialize one of hundreds of variables. : ) Collision is actually pretty quick when you implement it right.