Developer
Nov 14, 2012 at 5:20 PM
Edited Nov 14, 2012 at 5:22 PM
|
First Argument (Camera)
"BirdEyeCamera provides a bird-eye view of the scene. Use the right mouse button the pan the camera. Use the wheel button to zoom in and out. Hold down the mouse middle button to rotation the camera."
So it is easy to change what it looks at with the variable 'LookAt' that is an Vector3. Currently there are no features that you can disable camera movement. So personally I would recommend downloading the source or just look
it up with the help of Codeplex code lookup feature. And then make a own.
Second Argument (Make Objects Movable)
If you download the example there are a Component that is built in an external dll.
public class ExampleController : Component, Nine.IUpdateable
{
public float Speed { get; set; }
public void Update(TimeSpan elapsedTime)
{
var transform = Parent.Transform;
var keyboardState = Keyboard.GetState();
if (keyboardState.IsKeyDown(Keys.Left))
transform.Translation += Speed * (float)elapsedTime.TotalSeconds * Vector3.Left;
if (keyboardState.IsKeyDown(Keys.Right))
transform.Translation += Speed * (float)elapsedTime.TotalSeconds * Vector3.Right;
if (keyboardState.IsKeyDown(Keys.Down))
transform.Translation += Speed * (float)elapsedTime.TotalSeconds * Vector3.Backward;
if (keyboardState.IsKeyDown(Keys.Up))
transform.Translation += Speed * (float)elapsedTime.TotalSeconds * Vector3.Forward;
Parent.Transform = transform;
}
}
This can then be imported to Xaml by adding something like this 'xmlns:my="clr-namespace:TutorialData;assembly=TutorialData"'.
This should be in the '<Scene ... >'.
The other way is the do something like defining your object in Xaml by a Name. This make it easy to just use 'scene.FindName<T>("Name")'
If you would go this approach I would recommend by putting the object in a parent(Group) and transform it.
<Group Name="Player">
// Your Stuff
<Group>
Example in Code:
Group player = scene.FindName("Player");
// Something like this then in update
player.Transform.Translation += Speed * (float)elapsedTime.TotalSeconds * Vector3.Left;
I hope this helped :)
Eric
|