• Input Components (Components\InputComponents\BaseInputComponent.cs) 
    • All Input Components derive from the base class BaseInputComponent.cs.
    • I won’t describe all of the specific input components, because they are only used in very specific cases. In fact, that is the point of an input component. If you want a specific type of movement for an Entity based on specific conditions, you can use an Input Component to do it.
    • For this example, we’ll use the FreeCameraInputComponent. As the name implies, it is used for input on any Entity that needs to move and react like a Free Camera. As you might have guessed, you’d want to attach this to an Entity that has a Camera component. So, if you’ve got an Entity that is serving as a camera, attaching the FreeCameraInputComponent to it will let it behave just like a free roaming camera.
    • Input Components receive input messages, and can also poll for their own input types using an InputPollingHandler.  They can use that input however the component is setup to use it, and do any other processing needed for controlling movement through input. The FreeCameraInputComponent is a very simple input component, it simply queries for input, from the keyboard, mouse, or Xbox 360 controller, and moves according to the input it receives.
    • If you’d like to see something more complicated feel free to look at the ArcBallCameraInputComponent. Basically it starts a Vector3 position above the object each frame, and then rotates vertically and horizontally to the desired position and distance, and then processes input to determine its vertical and horizontal angles to rotate to, which can be used on any upcoming frame.
      • The 'Arc Ball' style Camera is the camera you start out in within the demo, the demo is setup to switch to this style of camera whenever the camera is attached to a controllable character.
    • CharacterInputComponent (Components\InputComponents\CharacterInputComponent.cs)
      • This is where input values for a controllable character is stored. A CharacterPhysicsComponent retrieves these values and turns them into actual movement.

Last edited Jan 5, 2012 at 5:57 AM by LordIkon, version 1


No comments yet.