Game Development Community

Mount sprite to camera

by Anton Bursch · in Torque Game Builder · 12/01/2006 (6:16 pm) · 8 replies

I want to have a object mount to the camera so that when i move the camera the object follows. I can easily mount the camera to an object, such as in the platformer tutorial, but I can't seem to mount an object to the camera. Anyone know how to do this? I'm sure I can fake it my changing controls so that the object moves and the camera follows, but I'd rather have a more logical approach if possible.

About the author

I design and direct games for Somatic Vision. We primarily make games for use with biofeedback, but our latest game, Tropical Heat, a jet ski racing game, is for regular gamers and is available on PC/Mac and will be available on ipad and iphone soon.


#1
12/01/2006 (11:27 pm)
Umm...you never move (control) the camera in TGB--there isn't even any way to actually do it without re-writing a lot of code.

Not sure what your game mechanic is here, but I really don't understand what you are getting at.

Worst case, just mount the camera to an invisible scene object and move it. Then you can mount anything else to that scene object as well.
#2
12/02/2006 (2:04 am)
Hmm you can use moveto function
so first you move the camera
and then have your object called moveto function to the camera position
but i don't know if it worked or not
#3
12/02/2006 (2:16 am)
Yeah, that's what i figured too, but the camera is being panned when the mouse is on the edge of the screen and it doesn't sync up. i'm just using schedule to sync the object and camera up 30xsecond.
#4
12/02/2006 (2:35 am)
Can you make the object move when the mouse is at the edge of the screen? Then the mounted camera will go with it.
#5
12/02/2006 (2:37 am)
I thought about that too. I can do that, but then all the smoothing of the camera gets lost.
#6
12/04/2006 (4:03 am)
You could have a "cameraTarget" scene object that your camera and the other objects are mounted to and do your smoothing on that object. This might be a silly question, but why not just use GUI controls? Is there a reason the object has to be in the scene?
#7
12/04/2006 (5:34 am)
@Thomas Buscaglia

It's an outline box in an RTS mini-map that shows what the game camera is seeing. Like in this screenshot of Warcraft 2. I thought of using a gui control. I think i'm just going to have to keep trying to think about how to do this.

www.macgamezone.com/images/tests/warcraft2bne/01.jpg
#8
12/04/2006 (7:15 am)
Upgrading to 1.1.3 solved my problem with this. Cool!