Game Development Community

UAV Camera Mounting

by Chris Skinner · in Torque Game Engine · 01/24/2006 (2:30 pm) · 16 replies

I have a UAV that will fly over a city and I've created a mountable node on the bottom of it for a camera that I can move with the mouse. The problem is that I don't know how to mount that camera.... any help would be greatly appreciated.

thanks !

#1
01/24/2006 (5:12 pm)
If your camera is part of your vehicle model...

In the modeling program you are using, you could attach the "eye" node (or make a node called "eye" and attach it) to your camera mesh. When in first person view, the game will use the "eye" node for the orientation and position of the client's camera.

Otherwise, if you want the camera to be a separate object, use %vehicle.mountObject(%camera,0), where 0 is whichever mount you're actually using (mount0 if you put 0). If you don't have a camera class, look for the turret resource. If you use that, you don't even need animations or anything to rotate the camera.
#2
01/24/2006 (7:10 pm)
Sounds good. I'll try it. Thanks !
#3
01/25/2006 (6:07 am)
"use %vehicle.mountObject(%camera,0), "

Do I do this in the game.cs ?
#4
01/25/2006 (6:34 am)
"use %vehicle.mountObject(%camera,0), "

Do I do this in the game.cs ?
#5
01/25/2006 (8:28 am)
I would add that in the ::onAdd(%this,%obj) function for the datablock. If you don't have one already, you can add it.

So, for instance:

UAV::onAdd(%this,%vehicle)
{
   %camera = new Camera() {
           ... datablock, etc...
   };

   %vehicle.mountObject(%camera,0);
}

That's basically how I'd do it (Tribes2 basically did the exact same for the tank w/ turret). This onAdd will get called on every new object with that datablock.

The rest comes down to how well the mounted object behaves while it is mounted. Some objects don't handle being mounted very well.
#6
01/25/2006 (2:00 pm)
I'm trying the "eye" way now. I took the I node and moved it down to the bottom of the UAV. I guess I thought that the firstperson view would automatically be from there but it's not working out that way. Actually, my UAV is a mountable object for the moment so when I moved the "eye" node down to where I want it I thought I'd see from that view. Any suggestions there ?
#7
01/25/2006 (7:45 pm)
Hmm. Are you sure you're exporting the eye node? I don't think it normally gets exported unless you tell the exporter to do it.
#8
01/26/2006 (5:16 am)
After it's exported I pull it up in ShowTool and it appears there so it seems to be exported correctly.
#9
01/26/2006 (8:13 am)
I got it ! Thanks Max ! Now I just want to zoom with the mouse wheel and pan with the mouse as well. Any suggestions on where to start ???
#10
01/26/2006 (5:12 pm)
Zoom is easy. There is a script-accessible function "setFov();" that will let you zoom in/out. Just set some global variable to be 90, and then add functions that get triggered by the mouse z-axis, and step up/down the FOV size by some coefficient. You could also save the zoom variable on the UAV (like %uav.zoom ) if you want the player to be switching to multiple UAV's or something... I guess it depends on your project, and how much you need the simulation's data structure to mimic reality.

But panning, actually...
Thats a bit more complex :)

The first question is, how does the UAV get controlled? If -flying- the UAV is done with point-and-click, or pre-planned paths, it's not as hard. If you use a joystick or the keyboard only for flight and you reserve the mouse for the camera, it gets easier. This has a large bearing on how you want camera control to work.

In addition:

If you use a mounted camera, it will be easier and quicker to do what you want. Looking around and animating the object to match the view is already done for you.

However, you can achieve a rotateable view without a mounted camera. Making the mesh animate in with the view may not be worth the trouble though! The basic idea to this implementation would be similar to the free-look functionality. Basically, sort of how flight sims let you use the joystick or keys to look left/right, etc.

So some questions:

- do you need to control the UAV?
- does the camera mesh on the UAV need to rotate as it looks around?
#11
01/31/2006 (6:08 am)
Actually I want the UAV to be AI or at least fly by itself around the city. I would certainly prefer to have the camera rotate as it looks around as well.
#12
02/04/2006 (11:29 am)
What program did you use to edit the eye mount node, i need to edit the mount point of the player camera so i need to edit the mount point, what program did you use to lower the camera or reposition it?
#13
02/06/2006 (5:57 am)
Studio MAX
#14
02/06/2006 (11:46 am)
Could i do the same thing in cinema 4d? as it's all i have, or blender?
#15
02/06/2006 (12:16 pm)
I know you can with blender for sure.
#16
02/07/2006 (11:36 am)
Cheers, thanks alot! any idea how or if not where i can learn?