Community Tip Thread
by practicing01 · in Torque 2D Beginner · 05/04/2013 (9:33 pm) · 25 replies
Post information you feel is useful to others about the engine, algorithms, art and game-dev in general.
Tip:
As you populate a child GuiListBoxCtrl of a GuiScrollCtrl, they will both resize automatically. A child GuiDynamicCtrlArrayControl of a GuiScrollCtrl will not do this, however. A method for dealing with this is keeping a counter variable that will represent the Y extent of the GuiDynamicCtrlArrayControl. Increase the counter with each item that you add to the list. When all of the items are added, change the Y extent of the GuiDynamicCtrlArrayControl and call computeSizes() on the parent GuiScrollCtrl. This will scale the scroll bars properly.
Tip:
As you populate a child GuiListBoxCtrl of a GuiScrollCtrl, they will both resize automatically. A child GuiDynamicCtrlArrayControl of a GuiScrollCtrl will not do this, however. A method for dealing with this is keeping a counter variable that will represent the Y extent of the GuiDynamicCtrlArrayControl. Increase the counter with each item that you add to the list. When all of the items are added, change the Y extent of the GuiDynamicCtrlArrayControl and call computeSizes() on the parent GuiScrollCtrl. This will scale the scroll bars properly.
#22
07/06/2014 (11:16 am)
If you only want to pick objects of the n:th scenelayer in a scene, you have to use the index n+1 in masking,%objects = %scene.pickPoint( %worldPosition, "", %n+1, "any" );I think this is illogical.
#23
07/06/2014 (1:04 pm)
@Eero - Can you explain a little further? What is the range of n you are using?
#24
07/06/2014 (2:31 pm)
The range of %n is [0, 31]. I guess there's an inconsistency somewhere in the engine, but I wasn't able to find it; counting layers begins from 0 onwards in one place and from 1 on in another?
#25
This is a way that seems to work:
07/06/2014 (4:26 pm)
I mislead myself on a false premise for hours. Here's the correction: the picking method interprets the integer representing the layer as a BITMASK. (I don't know if I should have got that from the word "mask"...)This is a way that seems to work:
%objects = %scene.pickPoint( %worldPosition, "", addBitToMask(0, %n), "any" );
Torque Owner Eero Karvonen
for the object.