Game Development Community

Help Mount Camera to object.

by YinYang · in Torque Game Builder · 09/30/2006 (4:48 pm) · 4 replies

Hello, I have been working on a game, but the biggest problem is I have not been able to mount the camera to the player, so I can oly see the very beginning, I would apriceate it if someone could help me with that.

I know the script is 'mount(%object, %offsetX, %offsetY, %mountForce, %sendToMount)'
but can someone give me an example on using it.

About the author

Recent Threads


#1
10/01/2006 (2:29 pm)
Sure, here you go:

function Player::onLevelLoaded( %this, %scenegraph )
{
   SceneWindow2D.mount( %this );
}

Edit: I accidentally wrote t2dSceneWindow instead of SceneWindow2D. Now it should work. Sorry about the confusion.
#2
10/01/2006 (3:53 pm)
Thank you SOOOOO MUCH!

it works now!
#3
12/18/2006 (11:20 am)
Wow, such a simple piece of code can do what I couldn't with much more complex code. I have a simple question to follow up this one. Before I ask the question, however, let me point out that I don't have TDN access yet.

First, I already found on another thread that it is possible to set up a View Limit for the camera that, once reached, keeps the camera from following the player, but still allows the player to continue moving. A lot of 2D console-RPGs do this (or, for example, Zelda: Link to the Past). This little piece of code is great, but I would like to know if it's possible to add slack to the camera's tracking so it seems as if the player is "leading" the camera. I think that most games of the above nature employ a technique like this. Come to think of it, I think that most non-first-person games tend to do something like this.

Thanks for any direction you may offer!
#4
06/24/2009 (11:52 pm)
im having this same problem but where do I add this? what file because I dont seem to find this:
# function Player::onLevelLoaded( %this, %scenegraph )

is this a new function i create?