Following the player with a custom camera - Does not Work
by Solloman · in Technical Issues · 03/18/2011 (10:03 am) · 1 replies
I swear im doing everything by the book but its not working, heres the code i write
protected override void BeginRun()
{
base.BeginRun();
SceneLoader.Load(@"data\levels\levelData.txscene");
T2DAnimatedSprite _player =
TorqueObjectDatabase.
Instance.FindObject
<T2DAnimatedSprite>
("player");
//get a hold of the camera object
T2DSceneCamera _camera =
TorqueObjectDatabase.Instance.FindObject
<T2DSceneCamera>("SceneCamera");
//ignore the rotation
_camera.TrackMountRotation = false;
//add a delay to the camera movement
camera.UseMountForce = true;
_camera.MountForce = 2.0F;
_camera.Mount(_player,"",false);
}
HELPAGE!!!!!
protected override void BeginRun()
{
base.BeginRun();
SceneLoader.Load(@"data\levels\levelData.txscene");
T2DAnimatedSprite _player =
TorqueObjectDatabase.
Instance.FindObject
<T2DAnimatedSprite>
("player");
//get a hold of the camera object
T2DSceneCamera _camera =
TorqueObjectDatabase.Instance.FindObject
<T2DSceneCamera>("SceneCamera");
//ignore the rotation
_camera.TrackMountRotation = false;
//add a delay to the camera movement
camera.UseMountForce = true;
_camera.MountForce = 2.0F;
_camera.Mount(_player,"",false);
}
HELPAGE!!!!!
About the author
www.solloman.com
Torque Owner Solloman
protected override void BeginRun()
{
base.BeginRun();
// load our scene objects from XML. Torque X is designed to load game data from XML, but this is not strictly required;
// anything in an XML file can also be created manually in C# code. The SceneLoader is provided by TorqueGame and can be
// used to load and unload XML files.
SceneLoader.Load(@"data\levels\levelData.txscene");
//get a hold of the camera object
T2DSceneObject _camera =
TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>
("Cam");
//get a hold of the player object
T2DStaticSprite _player = TorqueObjectDatabase.
Instance.FindObject<T2DStaticSprite>("player");
_camera.Mount(_player,"",true);
}