Question about Airplane tutorial 2.0
by Thomas Wrather · in Torque X 2D · 03/31/2008 (8:12 pm) · 14 replies
In step 5, either there is something I don't understand, or some text was accidentally omitted. It says to make a new object type "mainCamera". And then set the WorldView.RenderMask to mainCamera. This gives me a black screen. I can go into TXB and add the "mainCamera" object type to some sprites. Then they will show up on the screen. Was the TXB step left out of the tutorial, or did I just miss it?
#2
I haven't looked at the updates John posted but I can confirm that there should be a step where you use TXB to assign the "mainCamera" object type to all of the ship templates, the airplane and the tile mapped background.
John, if you read this, please update the tutorial accordingly.
04/01/2008 (9:10 am)
Hi Thomas,I haven't looked at the updates John posted but I can confirm that there should be a step where you use TXB to assign the "mainCamera" object type to all of the ship templates, the airplane and the tile mapped background.
John, if you read this, please update the tutorial accordingly.
#3
Further comments on the Airplane tutorial:
1) I did not have a file called StarterGame2D.txproj. Mine was called Game.txproj for some reason.
2) _Every_ time I added a component in Game Studio Express and TXB prompted me with "The Torque X component scheme file has changed. Would you like to reload it (recommended)?", my carrierTemplate got deleted. This is not really a problem with the tutorial, but a TXB bug.
3) Step 6 talks about "AnchorFlags" which are no longer applicable.
4) Step 6 talks about setting "NoRenderMask" which the code did not do. Also, experimenting seems to indicate NoRenderMask does not work. RenderMask will make things render, but NoRenderMask does not prevent things from not rendering. Is this a TorqueX 2.0 bug? Has anyone else observed this?
5) I had to put the compass and pointer on different layers to prevent the compass from obscuring half of the pointer.
6) I had to change the code from:
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject("Camera");
to
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject("Camera") as T2DSceneCamera;
04/01/2008 (6:37 pm)
Thanks, Josef. Adding "mainCamera" as you suggested worked.Further comments on the Airplane tutorial:
1) I did not have a file called StarterGame2D.txproj. Mine was called Game.txproj for some reason.
2) _Every_ time I added a component in Game Studio Express and TXB prompted me with "The Torque X component scheme file has changed. Would you like to reload it (recommended)?", my carrierTemplate got deleted. This is not really a problem with the tutorial, but a TXB bug.
3) Step 6 talks about "AnchorFlags" which are no longer applicable.
4) Step 6 talks about setting "NoRenderMask" which the code did not do. Also, experimenting seems to indicate NoRenderMask does not work. RenderMask will make things render, but NoRenderMask does not prevent things from not rendering. Is this a TorqueX 2.0 bug? Has anyone else observed this?
5) I had to put the compass and pointer on different layers to prevent the compass from obscuring half of the pointer.
6) I had to change the code from:
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject("Camera");
to
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject("Camera") as T2DSceneCamera;
#4
Some comments:
1) It doesn't really matter. There is only one "txproj" file per project. The name difference might have to do with your edition of TX.
2) I've noticed this too. If you create an object, name it then later delete it, you'll have all sorts of problems creating a new object with that same name later. When that happens to me I just use a new name for my object. I hope this gets fixed.
3) References to AnchorFlags should be removed from the tutorial instructions.
4) I believe that the "NoRenderMask" issue might be a bug in TX v2. The original tutorial set the NoRenderMask to "instrument" and "minimap" to prevent objects of those types from rendering in the WorldView GUISceneview. As you discovered, this does not seem to work anymore. I worked around the problem by creating the "mainCamera" object type and explicitly setting what should appear in the WorldView.
5) I had to do the same. It was in the project that I sent to John but I forgot to explicitly mention it to him.
6) The code for that line should be:
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject("Camera");
If "" was missing from the tutorial it must have been a typo.
Thanks for the feedback Thomas. I'll pass this along to John so he can update the tutorial.
04/01/2008 (6:58 pm)
Hi Thomas,Some comments:
1) It doesn't really matter. There is only one "txproj" file per project. The name difference might have to do with your edition of TX.
2) I've noticed this too. If you create an object, name it then later delete it, you'll have all sorts of problems creating a new object with that same name later. When that happens to me I just use a new name for my object. I hope this gets fixed.
3) References to AnchorFlags should be removed from the tutorial instructions.
4) I believe that the "NoRenderMask" issue might be a bug in TX v2. The original tutorial set the NoRenderMask to "instrument" and "minimap" to prevent objects of those types from rendering in the WorldView GUISceneview. As you discovered, this does not seem to work anymore. I worked around the problem by creating the "mainCamera" object type and explicitly setting what should appear in the WorldView.
5) I had to do the same. It was in the project that I sent to John but I forgot to explicitly mention it to him.
6) The code for that line should be:
T2DSceneCamera DefaultCamera = TorqueObjectDatabase.Instance.FindObject
If "
Thanks for the feedback Thomas. I'll pass this along to John so he can update the tutorial.
#5
John K.
04/04/2008 (12:01 am)
Ooops! Looks like my bad. I'll try to update the tutorial by this weekend and upload the new files before anyone else runs into the same problems. Thanks for clearing this all up Josef!John K.
#6
04/09/2008 (4:14 pm)
I know it's been mentioned many times, but I really wish there was a bug tracker to query. It would be nice to know if Garage Games is aware of the NoRenderMask issue. And if so, what the release target is for the fix.
#7
ValueInPlaceInterface _altitude = new ValueInPlaceInterface(0.0f);
ValueInterface _altitude;
These both were taken from the tutorials steps... seems something is wrong
04/15/2008 (9:57 pm)
I've try lastest version I can't compile it as there are to variables (altitude) declared in the same class with different types...ValueInPlaceInterface
ValueInterface
These both were taken from the tutorials steps... seems something is wrong
#8
05/01/2008 (8:14 am)
Has there been a new airplane tutorial released w/ the issues mentioned above resolved? If so, could someoen point me in the right direction???
#9
For now, please download a working copy of the project from my SkyDrive:
http://cid-4d2cc9cef179b5d2.skydrive.live.com/self.aspx/TorqueX2/AirplaneTutorial.zip
05/01/2008 (8:27 am)
I'll take a look at the tutorial text later today and see what changes might be required.For now, please download a working copy of the project from my SkyDrive:
http://cid-4d2cc9cef179b5d2.skydrive.live.com/self.aspx/TorqueX2/AirplaneTutorial.zip
#10
05/01/2008 (8:57 am)
Thanks Josef, I'll take a look!
#11
06/10/2008 (2:38 pm)
There's any update for this tutorial? I'm suffering from the same problems described above...
#12
WorldView.RenderMask = mainCamera; // only render objects of type "mainCamera"
Don't understand what that was yet
04/10/2009 (11:12 pm)
OK I know this is much later however I got it to work by commenting out the lineWorldView.RenderMask = mainCamera; // only render objects of type "mainCamera"
Don't understand what that was yet
#13
The tutorial uses one set of graphics for the main camera and a different set of graphics for the minimap.
Both sets of graphics are allied to the scene objects and the render mask for the individual cameras handles differentiating what should be shown.
If you comment out the rendermask for the main camera you'll end up seeing the minimap graphics in the main camera area.
Let me know if you are having trouble getting this working correctly.
@Guillermo, I didn't see your post until just now. If you need help, please let me know.
04/11/2009 (3:25 am)
Hi Henry,The tutorial uses one set of graphics for the main camera and a different set of graphics for the minimap.
Both sets of graphics are allied to the scene objects and the render mask for the individual cameras handles differentiating what should be shown.
If you comment out the rendermask for the main camera you'll end up seeing the minimap graphics in the main camera area.
Let me know if you are having trouble getting this working correctly.
@Guillermo, I didn't see your post until just now. If you need help, please let me know.
#14
04/11/2009 (10:03 pm)
Yea I see that, well now. So what I found you have to do is set your object type under the scripting rollout to mainCamera For anything you want to appear in the main camera. The good thing is you dont have to set all those spawners, just the 5 templates. : )
Torque Owner Matthew Shapiro
The ones with TorqueX weren't updated for 2.0 (from what I hear), although I specifically remember the camera object creation code being in it (as I used that code for my own camera).]
Here's the code I use (very slightly modified from the tutorial) to create the camera (sorry for the line numbers, I'm copying out of Trac since I'm at work):
69 T2DSceneCamera WorldCam = new T2DSceneCamera(); 70 WorldCam.Name = "mainCamera"; 71 WorldCam.CenterPosition = new Vector2(0.0f, -40.0f); 72 WorldCam.Extent = new Vector2(100.0f, 75.0f); 73 TorqueObjectDatabase.Instance.Register(WorldCam); 74 T2DSceneObject template = TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>("playerShipTemplate"); 75 if (template != null) 76 { 77 ship = (T2DSceneObject)template.Clone(); 78 ship.Position = new Vector2(0, 0); 79 TorqueObjectDatabase.Instance.Register(ship); 80 } 81 82 83 GUIStyle WorldStyle = new GUIStyle(); 84 GUISceneview WorldView = new GUISceneview(); 85 WorldView.Style = WorldStyle; 86 WorldView.Camera = WorldCam; 87 GUICanvas.Instance.SetContentControl(WorldView);