CollisionLayers in Datablocks don't work
by MrSpaceGame · in Torque Game Builder · 05/05/2012 (5:18 pm) · 4 replies
datablock t2dSceneObjectDatablock(PlayerConfig)
{
canSaveDynamicFields = "1";
Layer = "1";
size = "4 7";
CollisionLayers = "0 1 2";
CollisionActiveSend = "1";
CollisionActiveReceive = "0";
CollisionPhysicsReceive = "0";
CollisionPhysicsSend = "1";
CollisionCallback = true;
CollisionPolyList = "-0.57 -0.59 0.68 -0.59 0.67 0.96 -0.55 0.96";
CollisionResponseMode = "CLAMP";
CollisionDetectionMode = "CIRCLE";
CollisionCircleScale = "0.6";
UsesPhysics = "1";
AutoMassInertia = true;
Rotation = "0";
WorldLimitMode = "CLAMP";
WorldLimitMax = "50 38";
WorldLimitMin = "-50 -38";
};That's my datablock.
When I execute "echo($Player.getCollisionLayers());" ingame on the console, it returns nothing and collisions don't work.
When I use $Player.setCollisionLayers() everything is fine.
For me, that's a bug. If I am wrong feel free to move it :).
About the author
Torque Owner Justin Proffitt
Edit: No sorry, not binary. It is one single decimal value, that is interpreted as a binary value (like on/off switches for each layer)
e.g.
1 = 1
2 = 2
3 = 1 2
4 = 3
5 = 1 3
6 = 2 3
7 = 1 2 3
8 = 4
etc. (And -1 = All )
Edit2: I just remembered getCollisionLayers() and setCollisionLayers() will deceive you, because they automatically convert the single value into a list of layers and vice versa, respectively. So even though echoing "getCollisionLayers" will show you a list of layers that are turned on, the actual value for that field will be something different.