Game Development Community

CastCollision disobeying groups and layers?

by Eric Robinson · in Torque Game Builder · 09/13/2006 (7:04 am) · 4 replies

I used the MiniPlatormerTutorial as a starting point for some prototyping with the engine and have run into a bit of an issue: I mount an object (with its own collision) to the character and then he just floats around all day. If I jump then he essentially falls up forever. I would really like to separate the two objects (collision-wise), particularly for the purposes of castCollision. But, just to make sure I'm not wasting my time:

Does castCollision disobey collision groups and layers? Does it just look to see if something with a collision polygon *would* collide if it were, by chance, in the same group?



One more real quick one: which takes precedence? Collision groups or layers?

#1
09/13/2006 (3:01 pm)
Cast Collision AFAIK using the same collision bits as the object casting the collision (That sounds weird). Basicly the object doing the casting should obey all normal collision rules, all you are doing is seeing if the object will collide with another object in X amount of time.

"collision" groups are used to check collisions only. Layers are used as a rendering order. Eg, Layer 10 gets rendered, then Layer 9 on top of that, then layer 8 on top of that, then layer 7 etc.
#2
09/13/2006 (3:24 pm)
Then setCollisionLayers would do...?
#3
09/13/2006 (3:46 pm)
As I read the docs, collisions work within layers and can be further pruned to groups within layers. It's like there's two levels of filtering, you can filter out entire layers, and for the layers that are active you can filter out specific groups within that layer.
#4
09/14/2006 (3:22 am)
That's correct. For a collision to register, the reciever's graphGroup and the reciever's layer must be in the sender's CollisionGroups and CollisionLayers for a collision to occur. As for castCollision, it's supposed to use the collision groups/layers set on the object.