About Advanced Camera
by Matthew W · in Torque Game Engine · 01/19/2008 (4:52 pm) · 17 replies
Sorry if im posting in the wrong forum.
Today i've been trying to follow the Advanced Camera instructions that are here:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471
But after a little while i noticed that the code i just entered was already there and that made a compiling error. And after reading this paragraph
"After playing around with it, I also found you need some adjustments to the setCameraObject and setControlObject methods - otherwise the client connection can screw things up if you bounce the same object from your connection's control to camera or vice versa. Here is my GameConnection::setControlObject:
" - Thomas "Man of Ice" Lund
i noticed that there wasn't a difference between the two sections of code. And that proved true for the GameConnection::setCameraObject part too. This is a tutorial from 2004 - so, has the Advanced Camera code already been entered in Torque 1.5.2?
Today i've been trying to follow the Advanced Camera instructions that are here:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471
But after a little while i noticed that the code i just entered was already there and that made a compiling error. And after reading this paragraph
"After playing around with it, I also found you need some adjustments to the setCameraObject and setControlObject methods - otherwise the client connection can screw things up if you bounce the same object from your connection's control to camera or vice versa. Here is my GameConnection::setControlObject:
" - Thomas "Man of Ice" Lund
i noticed that there wasn't a difference between the two sections of code. And that proved true for the GameConnection::setCameraObject part too. This is a tutorial from 2004 - so, has the Advanced Camera code already been entered in Torque 1.5.2?
#2
im at Script
on this line: "First, add a datablock for the tracking camera to /fps/server/scripts/camera.cs:" where is this directory? There's game/fps/ but it contains nothing like camera.cs.
01/20/2008 (4:04 pm)
Thank you :)im at Script
on this line: "First, add a datablock for the tracking camera to /fps/server/scripts/camera.cs:" where is this directory? There's game/fps/ but it contains nothing like camera.cs.
#3
Also, have you ever heard of searching for files? Most operating system support this. Just tell it to search for camera.cs (everywhere on your hard drive(s)) and it will tell you where they all are.
01/21/2008 (4:18 am)
Try game/starter.fps/server/scriptsAlso, have you ever heard of searching for files? Most operating system support this. Just tell it to search for camera.cs (everywhere on your hard drive(s)) and it will tell you where they all are.
#4
/fps/server/scripts/camera.cs means for me.. /GameThrii/server/camera.cs
and
/fps/server/scripts/game.cs means for me.. /GameThrii/server/game.cs
In the engine code, we noticed that some of the code has already been added. But there is one line difference between the already added code and the tutorial's code- this,
should be changed? to this,
i've gotten to Script API. Where do you enter that code?
01/21/2008 (5:21 pm)
Ah! :) so../fps/server/scripts/camera.cs means for me.. /GameThrii/server/camera.cs
and
/fps/server/scripts/game.cs means for me.. /GameThrii/server/game.cs
In the engine code, we noticed that some of the code has already been added. But there is one line difference between the already added code and the tutorial's code- this,
ConsoleMethod(GameConnection, setCameraObject, S32, 3, 3, "")
should be changed? to this,
ConsoleMethod( GameConnection, setCameraObject, bool, 3, 3, "(ShapeBase object)")?
i've gotten to Script API. Where do you enter that code?
#5
The Script API code is not entered anywhere. It is merely a description/example of how to use the methods provided.
01/22/2008 (4:09 am)
Don't make any changes to the stuff that has already been added in.The Script API code is not entered anywhere. It is merely a description/example of how to use the methods provided.
#6
01/23/2008 (2:07 pm)
Thank you. Where can i put these examples to try them out? I just really don't know where to start. :(
#7
You need the reference to your camera and then call the various methods on it. I don't use the advanced camera and am not really familiar with it. I only looked at it for a week before tearing it apart and building my own camera.
01/25/2008 (5:30 am)
You can type them into the console ifi you know what you are doing but that section of the tutorial doesn't explain how to do that very well.You need the reference to your camera and then call the various methods on it. I don't use the advanced camera and am not really familiar with it. I only looked at it for a week before tearing it apart and building my own camera.
#8
This is what i tried: I held down the ~ key for a few seconds after running torqueDemo.exe and a window named "Console" came up. Then, i tried entering "setPlayerObject(); " and after hitting enter it says, "Unable to find function setPlayerObject." I know that i entered all of the scripting code correctly and didnt have to enter any of the code before that section because it was already there.
01/28/2008 (1:28 pm)
How do i get the reference to my camera? I dont understand. This question goes out to anyone. I feel uncomfortable bothering Brian so much. :)This is what i tried: I held down the ~ key for a few seconds after running torqueDemo.exe and a window named "Console" came up. Then, i tried entering "setPlayerObject(); " and after hitting enter it says, "Unable to find function setPlayerObject." I know that i entered all of the scripting code correctly and didnt have to enter any of the code before that section because it was already there.
#9
01/29/2008 (6:54 am)
There should have been a couple of areas where the code wasn't actually there in the Advanced Camera resource. Most of it is implemented, but the last time I did it in 1.5.2, I had to add bits and pieces throughout.
#10
im so confused.
02/01/2008 (1:50 pm)
There were a few parts when the code was a little changed, but i was told not to make any changes to stuff that has already been added in. But, i did make the small changes and it didn't help. Typing in "setPlayerObject();" still gives " (0): Unable to find function setPlayerObject"im so confused.
#11
Your camera object was created in the script and made active on the connection.
Also, it doesn't mention that setPlayerObject takes one parameter. The player.
This should have already been setup in the scripts when you added this stuff:
In fact, that code should have made your advanced camera work.
Do you see how it calls 'setPlayerObject' on the camera '%this.advCamera' and gives it one parameter '%player'.
From the console you need to use a few tricks to get the camera and player references but this should be equivalent:
%this just turns into LocalClientConnection because there is no %this reference (or if there is, it is pointing to something completely different at that point).
02/02/2008 (3:51 am)
You need to reference a camera object.Your camera object was created in the script and made active on the connection.
Also, it doesn't mention that setPlayerObject takes one parameter. The player.
This should have already been setup in the scripts when you added this stuff:
Quote:
...
// We set the camera system to run in 3rd person mode around the %player
%this.advCamera.setPlayerObject(%player);
%this.advCamera.setThirdPersonMode();
%this.advCamera.setFollowTerrainMode(false);
%this.advCamera.setVerticalFreedomMode(false);
%this.setCameraObject(%this.advCamera);
...
In fact, that code should have made your advanced camera work.
Do you see how it calls 'setPlayerObject' on the camera '%this.advCamera' and gives it one parameter '%player'.
From the console you need to use a few tricks to get the camera and player references but this should be equivalent:
// in the console LocalClientConnection.advCamera.setPlayerObject(LocalClientConnection.player);
%this just turns into LocalClientConnection because there is no %this reference (or if there is, it is pointing to something completely different at that point).
#12
[quote]
When i run torqueDemo.exe and type that into the console it fails and says:
(o): Unable to find object: '0' attempting to call function 'setPlayerObject'
but, when i type that into the build version of Torque SDK in Microsoft Visual c++ 2005 - it works. How do i replace torqueDemo.exe with the one that works in Visual c++?
Now, just pressing tab switches it into the right camera view - does that mean that console commands make permanent changes?
02/02/2008 (3:33 pm)
THANK YOU BRIAN! it works! :)[quote]
LocalClientConnection.advCamera.setPlayerObject(LocalClientConnection.player);[/quot
When i run torqueDemo.exe and type that into the console it fails and says:
(o): Unable to find object: '0' attempting to call function 'setPlayerObject'
but, when i type that into the build version of Torque SDK in Microsoft Visual c++ 2005 - it works. How do i replace torqueDemo.exe with the one that works in Visual c++?
Now, just pressing tab switches it into the right camera view - does that mean that console commands make permanent changes?
#13
Does that mean every time you start the engine now it does that when you hit tab? Or does it switch back to the standard camera when you exit the console?
Console commands can change preferences which in turn are saved and can be viewed as permanent.
I don't think this is the case however. It depends on your answer to the question above as to what I think is wrong but if the view is switching back and forth between the standard camera and the advanced camera every time you enter and exit the console, I think I know what is wrong.
It seems the camera object isn't being properly ghosted to the client. Let me know and we can track this down a little more. I think I remember something about this... I'll look into it.
Please describe your scenarios in great detail. I'd like to know what happens every time you enter and exit the console as well as every time you start and restart the game.
Finally, you will need to locate the output for your project in Visual Studio and copy the exe to your project directory. This can be done automatically for you if you properly setup your project file. Usually I just go into the project settings and change the output location for the exe to be in my project folder. You can get to this option by opening the properties for the project (right click on project in solution and select properties) and going to Configuration Properties -> Linker -> General and changing the 'Output File' property.
02/03/2008 (2:20 am)
What do you mean by 'just pressing tab switches it into the right camera view'?Does that mean every time you start the engine now it does that when you hit tab? Or does it switch back to the standard camera when you exit the console?
Console commands can change preferences which in turn are saved and can be viewed as permanent.
I don't think this is the case however. It depends on your answer to the question above as to what I think is wrong but if the view is switching back and forth between the standard camera and the advanced camera every time you enter and exit the console, I think I know what is wrong.
It seems the camera object isn't being properly ghosted to the client. Let me know and we can track this down a little more. I think I remember something about this... I'll look into it.
Please describe your scenarios in great detail. I'd like to know what happens every time you enter and exit the console as well as every time you start and restart the game.
Finally, you will need to locate the output for your project in Visual Studio and copy the exe to your project directory. This can be done automatically for you if you properly setup your project file. Usually I just go into the project settings and change the output location for the exe to be in my project folder. You can get to this option by opening the properties for the project (right click on project in solution and select properties) and going to Configuration Properties -> Linker -> General and changing the 'Output File' property.
#14
i'm not sure what to put for what happens when i exit.. i press esc and the screen comes up "Exit from this mission?" Then i press yes and it brings me back to the gameOne screen; after that i click the x in the corner to quit.
The new 3rd person view is not the one we need. In first person view i type in:
LocalClientConnection.advCamera.setOrbitMode(); into the console and after pressing enter nothing happens. Then after closing the console window i press tab and that puts me into the orbit camera; that's the one we want. But, everytime we start or restart a game we have to type in that line for orbit mode to work ..after pressing tab.
I hope this will help you - thank you for "looking into it". :)
02/04/2008 (9:40 pm)
Ok, when i enter the console the gameOne screen shows up. After clicking on start i drop from the sky, falling, and then crash on the ground and then stand up; all of that is in first person. When i press tab it switches to a new 3rd person view. If i restart from here it brings me back to the gameOne screen with the start button. After clicking start the same thing happens again.. dropping falling to crash on the ground and stand up - all of this in first person as before. Pressing tab changes it into the same new 3rd person view.i'm not sure what to put for what happens when i exit.. i press esc and the screen comes up "Exit from this mission?" Then i press yes and it brings me back to the gameOne screen; after that i click the x in the corner to quit.
The new 3rd person view is not the one we need. In first person view i type in:
LocalClientConnection.advCamera.setOrbitMode(); into the console and after pressing enter nothing happens. Then after closing the console window i press tab and that puts me into the orbit camera; that's the one we want. But, everytime we start or restart a game we have to type in that line for orbit mode to work ..after pressing tab.
I hope this will help you - thank you for "looking into it". :)
#15
We like using the orbit mode but want to change it's focus to a box. We were trying to use
02/06/2008 (1:43 pm)
We have a question about implementing the camera with Advanced Camera. As before, this question is for anyone. :)We like using the orbit mode but want to change it's focus to a box. We were trying to use
LocalClientConnection.advCamera.setTargetObject();but we don't know what the proper name for our object is. After naming it box1 and trying out
LocalClientConnection.advCamera.setTargetObject(box1);it didnt work. How can you tell what the object's name is?
#16
Nevermind. :) After adding a torque logo and naming it Logo, if you enter
LocalClientConnection.advCamera.setPlayerObject(Logo);
LocalClientConnection.advCamera.setOrbitMode();
it works!
02/08/2008 (9:24 am)
Quote:We have a question about implementing the camera with Advanced Camera. As before, this question is for anyone. :)
Nevermind. :) After adding a torque logo and naming it Logo, if you enter
LocalClientConnection.advCamera.setPlayerObject(Logo);
LocalClientConnection.advCamera.setOrbitMode();
it works!
#17
04/28/2008 (10:28 am)
Ok, i've started over with a new build and have entered the code from Advanced Camera into my scripts. But the camera is stuck in the starting position up in the sky. How can you get out of this starting camera mode?
Torque Owner Michael Bacon
Default Studio Name