Game Development Community

AdvancedCamera Question

by John Klima · in Torque Game Engine · 06/05/2005 (12:56 pm) · 15 replies

Greetings,

new to the forum and torque, please let me know if this post belongs somewhere else.

i'm working with the advancedCamera and i think i have it hooked in and running. i can make it go into orbit mode. however, to do so, i need to hit f8 and/or tab to get it out of what i guess is "normal" camera mode.

so the question is, how do i make it go into orbit mode immediately on load? should it and i'm missing something?

please note that i integrated this into tutorial.base, not fps. i do not think that this is an issue, lemme know if it is!

thanks!
j

#1
06/05/2005 (12:59 pm)
By default, the engine starts in first person mode, which overrides the orbit mode functionality. IIRC, this is actually done on the c++ side of things (probably a constructor of one of the primary objects, possibly the camera itself).

If you search for "firstPerson" in both your c++ and your .cs, you should be able to track down where this happens.
#2
06/05/2005 (1:16 pm)
Wow that was fast for a sunday!

i found 58 occurences of firstPerson in the cc source this one seems promising:

bool GameConnection::mFirstPerson = true;

do i just set ::mFirstPerson to false?

oh and a really stupid question, do you know how to get vc6 to recognize .cc's as source? they appear as plain text files.

j
#3
06/05/2005 (1:19 pm)
Holy cow, that seemed to work! that's all it needed.
#4
06/05/2005 (2:08 pm)
There should be a registry file (.reg) you can run to get VS to recognize the .cc files. Look in the VC6 or VC7 directory of your Torque install.
#5
06/05/2005 (2:43 pm)
Thanks rodney,

i tried that, even rebooted, no luck???
#6
06/06/2005 (11:02 am)
If you dont like to fiddle with the sources, you can add a $firstPerson = false; in your client side playGui.cs script in the onWake() method :-)
#7
06/06/2005 (5:25 pm)
Thanks thomas, i thought there might be a script-side approach. i'm not *too* scared of the source though.

i'm quite pleased with torque so far, i didn't realise just how huge it is. i locked myself down in front of it for the weekend, did tutorials, and i think i can be productive. that's a good sign.

from the quick response in the forum, plus the fact that i was able to step-by-step muddle through the camera changes from the forum post with success, give me the impression that it was a well spent hundred clams (plus the fifty for RTS pack, which i'll get into soon enough).

thanks all!
j
#8
06/06/2005 (11:21 pm)
Is there any way to adjust OrbitMode so that whenever it is activated, it is initially facing the same direction that the player character is facing? The current setup where OrbitMode independantly preserves its previous orientation makes swapping camera modes a bit jarring.

In my specific project, the player will be swapping between OrbitMode and ThirdPersonMode quite a bit; I need the camera view to remain reasonably stable between the two modes.
#9
06/07/2005 (8:05 am)
I did this by hacking up the keybinding functions, so that when you activate the orbit mode on keypress (in my case the right mouse button), it takes the direction of the player and sets the direction the orbit is facing to the players direction.
#10
06/07/2005 (8:59 am)
Can you post a sample of that thomas? i'm still a bit unclear how to best get/set transforms.

thanks,
j
#11
06/07/2005 (1:50 pm)
I'd much appreciate a sample too; my attempts at manipulating $advCamera::Yaw, Pitch, etc don't seem to bear any results. I'm not even getting console errors.
#12
06/09/2005 (12:47 am)
Well, I guess I'm halfway there. Working from this thread, I managed to retrieve the player's rotation, but the rotation retrieved is in quaternions. How do I convert the quaternion values to Azimuth and Declination?
#13
06/09/2005 (6:41 am)
I don't think you need to convert from the quat to an euler value as the camera undoubtably accepts quats in it's transform. the issue is setting the camera at all. what i think is going on is that regardless of what you tell the camera, it's going to point from it's current position, to the player geometry, as this is it's default behavior. to see this, try setting the cam in god view and play with the offset values, you will see what i mean.

%this.advCamera.setGodViewMode();
%this.advCamera.setGodViewOffset("5 5 30");

as you fiddle with the xyz of the offset, the camera is placed at that position, and points towards the player. what you could do is project a vector out the back of the player's head using the inverse of the player's quat, to some length that you specify, and convert that to an xyz point in space. then set the cam offset to that point and the cam will face behind the player.

sorry to say, i'm still too new w/ torque to tell you just how to go about that.
#14
06/09/2005 (2:46 pm)
I'm working with OrbitMode, so unfortunately just resetting the offset doesn't give me suitable results. I need to convert to spherical coordinates.
#15
06/09/2005 (3:53 pm)
There are initialization values in the code for the orbitMode, you should be able to modify them just prior to swapping modes.