How to extend Nine Engine Camera and other Component?

Feb 22, 2013 at 9:49 AM
Hi Development Team.

How i create a user-defined Camera like TPS or FPS ? and other Component, for example: Light, Effect ?
Feb 23, 2013 at 1:47 AM
Edited Feb 23, 2013 at 2:19 AM
Hi, i have downloaded your source code but the source is missing some version.cs files. Can i remove them in the projects ?

Is there anyway I use my own camera? by using a method of the class Scene?
Coordinator
Feb 23, 2013 at 3:47 AM
The Version.cs file is located under Build/Version.cs. You cannot remove them because the content pipeline and InternalVisiblesTo attribute rely on the version number.

You can create your own camera, just by subclass Nine.Graphics.Camera and update the Transform property accordingly.
Feb 23, 2013 at 12:37 PM
hi yufeih, i don't understand what you say about 'update the Transform property accordingly', could you give me more details?

I have a FixedCamera such as


class FixedCamera : Camera
{
    public Vector3 Position {get;set;}
    public Vector3 Target {get;set;}
    public FixedCamera(GraphicsDevice device, Vector3 position, Vector3 target)
        : base(device)
    {
        this.Position = position;
        this.Target = target;
    }

    public Matrix Projection
    {
        get
        {
            return Matrix.CreatePerspectiveFieldOfView(
                2 * MathHelper.PiOver4,
                this.GraphicsDevice.Viewport.Width / (float)this.GraphicsDevice.Viewport.Width, 
                1f, 
                10000f);
        }
    }

    public Matrix View
    {
        get
        {
            return Matrix.CreateLookAt(Position, Target, Vector3.Up);
        }
    }
}
I add the camera to scene using Add method, but the camera is not effect. How can i use Project and View matrix of a custom camera?