Game Development Community

How do i link a camera to a player.

by Brian Irvin · in Torque X 3D · 09/11/2009 (11:48 pm) · 6 replies

Hey i was following a tut on you tube and well it showed how to add the animation component, and player but how do i link this together so the boom bot moves on the terrain instead of a jet powered camera flying over my blank desert terrain.

#1
09/12/2009 (1:15 pm)
Page 264 for those with the Torque X book. But in a nutshell, you rename the FreeCameraComponent in the level file to a T3DCameraComponent. Then, as the game is updating, set the position of the camera to follow the player using the camera's SetTransform() method. This can be done in either the Update() method for the Game class or in another component.

John K.
www.envygames.com
#2
09/12/2009 (1:20 pm)
Actually, I just thought of a better answer. Go to my website, then go to the Torque X page dedicated to the book. At the bottom, you can download the source code to the book. In the chapter 12, you should find the MovementComponent I'm talking about. Just remember to rename the camera in the levelData.txscene file.

John K.
www.envygames.com
#3
09/12/2009 (4:21 pm)
aye im sure the book has all the answers just trying to get a quick animated toon walking on the terrain until i can get the money to get the book. But ill take a look at the code.
#4
09/13/2009 (12:49 am)
I waited until I got access to a decent ( 25% off )coupon from Barnes and Noble before I bought. I had to buy online because no bricks and mortar store I checked, even in Eugene, Oregon, carried it.
#5
10/25/2009 (7:09 pm)
Hey guys,

I have the book ;-) and I've been following this section.

I have a question with regard to gamepad input.

After I add the MovementComponent3D, I get some warnings.

Warning 1 'StarterGame3D.MovementComponent3D.ProcessTick(GarageGames.Torque.Sim.Move, float)' hides inherited member 'GarageGames.Torque.T3D.T3DInputComponent.ProcessTick(GarageGames.Torque.Sim.Move, float)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. C:\Users\Tim\Documents\Visual Studio 2008\Projects\Junk V0.01\Junk\Game\player\MovementComponent3D.cs 63 29 Game

Warning 2 'StarterGame3D.MovementComponent3D.InterpolateTick(float)' hides inherited member 'GarageGames.Torque.T3D.T3DInputComponent.InterpolateTick(float)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. C:\Users\Tim\Documents\Visual Studio 2008\Projects\Junk V0.01\Junk\Game\player\MovementComponent3D.cs 68 29 Game

For some reason i can move the player with the keyboard but the camera only follows the player and dosen't move around him. Plus the gamepad dosen't work what so ever.

Any ideas?

Thanks
#6
10/25/2009 (8:19 pm)
Sorry,

Just an update, I solved the issuses with the previous warnings.

I've also noticed that the left thumbstick, when clicked, brings a diaganostic screen up.

All other gamepad controls are non functioning.

Thanks again!