Game Development Community

Camera Question

by Michael S · in Torque Game Builder · 07/26/2007 (5:59 pm) · 4 replies

This Function is to mount a camera to an object
mount(%object, %offsetX, %offsetY, %mountForce, %sendToMount)

But I don't quite understand the explanation of
1. %offsetx / % offsety
2. %mountforce
3. %sendtomount

I read the parameter's explanation on the documentation , but I Confused.
Is there any more clear explanation to this 3 parameters ?

#1
07/26/2007 (11:44 pm)
I'll take a stab at answering this one, so anyone else wanna correct me if I happen to fudge it up!

Quote:1. %offsetx / % offsety
Alrighty, normally when you mount the camera to an object, the camera is locked onto the center (or the mount point) of that object. These two arguments allow you to shift the X and Y location that the camera is locked onto, respective to the original mount point.

Quote:2. %mountforce
I believe this determines how 'hard' the mount is. Does the camera stay rigidly locked onto it's mount? Or does it 'lag' a little and try to catch up with the mount?

Quote:3. %sendtomount
Ummm, actually I'm not sure what this one does, but I think it *might* be a callback.

Anyone else wanna debug my answers?
#2
07/27/2007 (4:22 am)
Hmm I tried to practice making perfect movement of feeding frenzy2 and i got problem with the camera things

This is what i got when playing feeding frenzy2

1 The camera only move when the fish almost touch the border of camera ,
So not "when my fish move ,my camera is also move".
From what i know the mount function always make the camera move when
my sprite move just a little.

2. Feeding frenzy2 ALWAYS make the mouse pointer at the center of the camera
so when the mouse move little they calculate the degree
between mouse position and the camera center point
to decide where my fish should go to.
And the problem is when i used mount function the camera center position
can exceed the limit that is described by setviewlimiton

for example
--> scenewindow2d.setviewlimiton(-100,-100,200,150);
--> scenewindow2d.mount(myfish,0,0,0,true);

the possible camera center positionx is between 0 until 150
and the possible camera center positiony is between 50 until 100

Ps:My camera sizearea is 800 pixel x 600 pixel

But guess what my camera center position can exceed the limit
I've tried it by using scenewindow2d.getcurrentcameraposition();

So i can't set my mouseposition to the center camera position as it can exceed the limit

Is there any solution for this problem?
#3
07/27/2007 (11:57 am)
Hmmmm, to be honest most of what you're attempting is beyond my experiance, so I'll let someone else take the ball here.

As for question 1 above:
Quote:1 The camera only move when the fish almost touch the border of camera ,
So not "when my fish move ,my camera is also move".
From what i know the mount function always make the camera move when
my sprite move just a little.

I do remember seeing a thread about much the same thing, where the developer wanted a camera system that only moved when a designated object approached the edge, but also where the camera could not move 'out of bounds'.

Gimme a bit to see if I can find that thread again and I'll link it for ya. Might be some useful info there.


Edit:
After a quick search this was the only relevant thread I could find. Still not sure if this is the same one I saw, but feel free to look it over and see if it helps ya any.
www.garagegames.com/mg/forums/result.thread.php?qt=26865
#4
07/27/2007 (6:02 pm)
I've found it .Thx anyway Trace kern

http://www.garagegames.com/mg/forums/result.thread.php?qt=63596

Hope this link will usefull to anyone who has the same problem .

Now the problem is only the center camera position can exceeds the constraint
that is described by setviewlimiton () ( problem no 2)