Game Development Community

Layers 0 and 1 always render

by Kenneth Rodgers · in Torque Game Builder · 04/21/2010 (1:26 pm) · 4 replies

I only want to render certain layers, so I use a line of code that looks like this:

MiniMap.setRenderLayers("layers$ 22 24 25 30");

Where MiniMap is a t2dSceneWindow.

This works fine, except that it is also rendering layers 0 and 1. I may have to dig into the source later, but I was just wondering if anyone else had this problem? and if this was a bug?

#1
04/21/2010 (1:34 pm)
Take out the "layers$" from your string:
MiniMap.setRenderLayers( "22 24 25 30" );

"setRenderLayers" goes though each string calling "atoi" on it (alpha to integer). The first string will become a "0".

That doesn't explain why layer 1 is always rendering, but it's a good place to start.
#2
04/21/2010 (1:39 pm)
Thanks Will, I'll give that a shot when I get home later. I found an example a long time ago that had the "layers$" at the beginning of the string, and since the method seemed to be working fine for the most part I didn't think anything of it.
#3
04/21/2010 (3:26 pm)
This topic gives me an idea for my game. It sounds like you can have a scenewindow on top of the main level? Does this mean everything in the scenewindow is not affected by camera zoom and stuff like that?
#4
04/21/2010 (4:45 pm)
@William
Thanks Will it worked beautifully! I thought I had stuff rendered on layer 1 but I do not, it was all on layer 0. So when I made the change you suggested, it worked great.

@Kevin
Yup, I have a separate, smaller scenewindow on top of my main SceneWindow that I use for a mini map.

What I do is set the SceneGraph for the minimap to the same one that the main scenewindow is using. Then I can set the zoom level for the camera for only the minimap. That way I get a zoomed out version of the entire level in the little minimap window.

From there I tell it what layers I want it to render, and in that way I control what you can see from the minimap.