Camera Positioning
by Matt McCracken · in Torque X 2D · 01/16/2008 (8:49 pm) · 3 replies
How would I go about changing the position of the camera? I would assume it to be something like:
camera.Transform = Matrix.Identity*Matrix.CreateTranslation(object.Position);
but the Transform property is readonly?
I've tried using camera.PositionOffset, RotationOffset, etc, but they don't seem to affect the position of the camera.
I've also tried:
T3DSceneComponent cameraScene = new T3DSceneComponent();
cameraScene.Position = new Vector3(0, 0, 0);
cameraScene.SceneGroup = "CameraComponent";
camera.Components.AddComponent(cameraScene);
Which also doesn't seem to have any effect.
Any advice? Basically I want to lock my camera in a top down view on my player object and have the camera follow the object.
camera.Transform = Matrix.Identity*Matrix.CreateTranslation(object.Position);
but the Transform property is readonly?
I've tried using camera.PositionOffset, RotationOffset, etc, but they don't seem to affect the position of the camera.
I've also tried:
T3DSceneComponent cameraScene = new T3DSceneComponent();
cameraScene.Position = new Vector3(0, 0, 0);
cameraScene.SceneGroup = "CameraComponent";
camera.Components.AddComponent(cameraScene);
Which also doesn't seem to have any effect.
Any advice? Basically I want to lock my camera in a top down view on my player object and have the camera follow the object.
About the author
#2
The WASD is control was defined within an InputMap attached to the FreeCameraComponent. You can try replacing the FreeCameraComponent with the basic T3DCameraComponent by changing your levelData.txscene file.
From:
To:
Then, you should be able to manually set the position (at least the X,Y) of the camera as you described above to match you player's position and get the top-down result.
John K.
01/17/2008 (4:29 pm)
Matt,The WASD is control was defined within an InputMap attached to the FreeCameraComponent. You can try replacing the FreeCameraComponent with the basic T3DCameraComponent by changing your levelData.txscene file.
From:
To:
Then, you should be able to manually set the position (at least the X,Y) of the camera as you described above to match you player's position and get the top-down result.
John K.
#3
Thanks for your help John. I'll keep checking back to see if there is any tutorials or documentation to help out new users.
01/17/2008 (7:06 pm)
I think I'm going back to straight XNA until there is some documentation for this stuff.Thanks for your help John. I'll keep checking back to see if there is any tutorials or documentation to help out new users.
Torque Owner Matt McCracken
camera.SceneGroup.position.
How do you disable w a s d controlling camera movement in the demo 3d project though?