Game Development Community

Overhead Camera fixed on Player

by Eric South · in Torque 3D Professional · 04/15/2012 (12:36 pm) · 5 replies

I'm not very experienced with the Camera object, so forgive me if this is somewhat obvious. I've setup an overhead camera and need to tie it to the player. The player is controlled by the mouse via left clicks. I'm not quite sure how to go about achieving this or where it should go.

What am I needing to look at and where should the code be called? Should some follow or path command be called when the player clicks, or...? Not really sure here. Any and all help is appreciated.

#1
04/15/2012 (12:52 pm)
Under the T3D Documentation -> Scripting -> Advanced -> RTS Prototype, that should get you under way for most of it :)
#2
04/15/2012 (1:52 pm)
The RTS tutorial camera is overhead but is not centered on or following the player. It's is moved with wasd keys
#3
04/15/2012 (6:01 pm)
Maybe the recent Top Down Shooter Resource will help you in combination with the RTS Prototype.
#4
04/15/2012 (8:30 pm)
I found that adding the following command onto the overheadCam function in commands.cs did the trick for me while maintaining the overhead camera:

%client.camera.setOrbitObject(%client.player, "1.0 0 1.0", 3, 25, 0, false, "0 0 0", true);

@Michael thanks for pointing me towards that resource, it put me in the right direction.
#5
04/16/2012 (1:40 am)
eric or anybody,
what means by last 3 parameter of setOrbitObject()?

in sript manual:


ownClientObject [optional] Are we orbiting an object that is owned by us? Default is false.
offset [optional] An offset added to the camera's position. Default is no offset.
locked [optional] Indicates the camera does not receive input from the player. Default is false.



what means "an object that is owned by us"?

"does not receive input from the player"
what type of input ?

"An offset added to the camera's position"
i am always confused with offset.
will this value be added to camera's position?

also i did not find any effect of 4th parameter
"initDistance The initial distance from the orbit object or point."