Trying to find/make an "Attach Camera" component
by Matt Delph · in Torque X 2D · 08/24/2010 (7:03 pm) · 1 replies
I've been working through the tutorials in the official documents, but ran into a problem with Airplane tutorial (nothing wrong with the tutorial, just the way I was doing it). Instead of starting with out with the "Starter Game 2D", I went with the "TorqueX GUI 2D".
Basically, my problem is, because I went with the GUI starter kit instead of the blank one, where do I put the code for attaching the camera to the plane? It wants me to put it in "game.cs", but that's where all the stuff is to launch the splash screens and menus.
This problem led me to wonder if anyone made a component that you just add to, in my case, the airplane, that attaches the camera without the need for any extraneous code. (I've seen this in Henry Shilling's Gamekit, but it was part of his control component and I failed horribly at just trying to extract the lines that mentioned "camera" :P .)
Sorry if this sounds difficult (or outrageously easy), but I'm still learning the engine (...and C# ...and XNA) so I don't exactly have an idea as to what's hard/easy or possible/impossible.
Basically, my problem is, because I went with the GUI starter kit instead of the blank one, where do I put the code for attaching the camera to the plane? It wants me to put it in "game.cs", but that's where all the stuff is to launch the splash screens and menus.
This problem led me to wonder if anyone made a component that you just add to, in my case, the airplane, that attaches the camera without the need for any extraneous code. (I've seen this in Henry Shilling's Gamekit, but it was part of his control component and I failed horribly at just trying to extract the lines that mentioned "camera" :P .)
Sorry if this sounds difficult (or outrageously easy), but I'm still learning the engine (...and C# ...and XNA) so I don't exactly have an idea as to what's hard/easy or possible/impossible.
Torque 3D Owner Will O-Reagan
Modern Intrigues
Try adding this line of code to a brand new fresh T2DComponent, in the OnRegister
T2DSceneObject cam = TorqueObjectDatabase.Instance.FindObject("Camera") as T2DSceneObject cam.Mount(SceneObject, "", false);