Game Development Community

I cant understand about Collision Layers?

by Matthews_30 · in Torque Game Builder · 08/09/2006 (10:58 am) · 1 replies

Can somebody explain me please?

i read the tutorial but i cant understand it, very clear.

Thanks a lot.

matt.

#1
08/09/2006 (11:04 am)
When you bring an object into the scene, it's placed on a layer. Layer's are useful because you can position what goes behind or in front of something. For example, the background (eg. sky) would be on layer 30, which is near the back. This means that anything put on layers 1 to 29 will be placed in front of it.
Now say you had an object that you wanted to have in the background. For example, a telephone box. You don't want the player to collide with the telephone box, but you want a grenade to collide with it. You would use the "setCollisionLayers" command. Say the telephone box was on layer 10, and the player was on layer 2. You would set the player to not collide with layer 10. This means that the player will walk through anything on layer 10, such as the telephone box. However, if you have a grenade, you can set it to collide with layer 10. This means that the grenade can explode the telephone box, but the player can't walk in to it. Having collision layers means you can seperate what collides with what.