SetCollisionMasks
by Seth Willits · in Torque Game Builder · 03/05/2005 (10:34 pm) · 5 replies
If I have a sprite in group 1 and a layer in group 2, if I set the collision masks as:
then collisions don't take place. The documentation says that setCollisionMasks has paremters (groupMask / [layerMask]) though
a) I think it's supposed to say (groupMask, [layerMask])
b) The default for the layerMask doesn't appear to be all since despite my trying, it doesn't work.
$player.setCollisionMasks(BIT(2)); $layer.setCollisionMasks(BIT(1));
then collisions don't take place. The documentation says that setCollisionMasks has paremters (groupMask / [layerMask]) though
a) I think it's supposed to say (groupMask, [layerMask])
b) The default for the layerMask doesn't appear to be all since despite my trying, it doesn't work.
About the author
http://www.sethwillits.com/
#2
03/06/2005 (2:10 am)
Yes, I realize all the other stuff needs to take place, and I do indeed do all that. The issue though is that if you don't specify the layer in the setCollisionMasks call, then collisions don't happen. In other words, I'm not seeing the default "all layers" value actually being used.
#3
I just checked the code and the masks are defaulting to zero! I'll change that, expect "all-on" behaviour in the next update.
Sorry for elaborating but at the moment, I'm trying to be as verbose as possible so that others reading this stuff get as much info as possible. Of course, I run into the possibility of coming across as a little patronising. ;)
Thanks for the heads-up.
- Melv.
03/06/2005 (4:42 am)
You are indeed correct!I just checked the code and the masks are defaulting to zero! I'll change that, expect "all-on" behaviour in the next update.
Sorry for elaborating but at the moment, I'm trying to be as verbose as possible so that others reading this stuff get as much info as possible. Of course, I run into the possibility of coming across as a little patronising. ;)
Thanks for the heads-up.
- Melv.
#4
03/06/2005 (11:04 am)
No problem. I'm glad to have contributed!
Associate Melv May
The default for any masks are "0XFFFFFFFF" (Bits 0-31 all selected) throughout T2D.
With regards to your collisions, this is just part of setting-up the collisions.
Things that are related to collisions that you should configure (or at least know the defaults):-
- Group/Layer for objects (setGroup/setLayer) default is group#0 and layer#0
- Collision Active (setCollisionActive) defaults are send=false and receive = false (essentiall off)
- Collision Polygon (setCollisionPolyPrimitive/setCollisionPolyCustom) defaults is quad-polygon (sames as bounding-box)
- Collision Polygon Scale (setCollisionScale) default are (1.0, 1.0)
... and for physics response to a collision ...
- Collision Physics (setCollisionsPhysics) defaults are send=false and receive = false (essentiall off)
Hope this helps,
- Melv.