Heya LumberYard dudes and dudettes!
I thought I would get in touch because I am looking for a few pointers on third-person camera controls and modularising the shoddy code I am currently writing
I’m currently using the FeatureTests solution as a base to play around with actors and cameras. I looked at the FlyCameraActor implementation and from that created my own ThirdPersonActor class which is my IActor implementation. I have physicalized it and plan to move it in a 2d plane using the WASD keys. This much I (vaguely) understand.
I’m now looking into pulling the first person camera back and out into an orbital camera. It would be nice to pull this out into its own class to separate the camera from the character. In the FeatureTests Actor.h file there is this little snippet:
* #TODO
* This actor is also an IGameObjectView to simplify setup of a project.
* It is recommended that you create a GameObjectExtension or separate actor to
* function as your camera instead.
So what I did was stop Actor inheriting from IGameObjectView and added my own TPCamera class which will implement the relevant IGameObjectView functions, handle mouse input for orbital rotation and update the camera position and rotation appropriately.
class CTPCamera : public CGameObjectExtensionHelper<CTPCamera, IGameObjectExtension>, public IGameObjectView, public IInputEventListener, public IActionListener
It is an IGameObjectView for the UpdateView functions, InputEventListener for the mouse action, IActionLIstener for any actionmap.xml stuff like maybe resetting the camera and then it is also an IGameObjectExtension; this is where I start getting really confused.
-
Should both the ThirdPersonActor and the TPCamera inherit from IActor?
-
Should the TPCamera just be an IGameObjectExtension?
-
Should I even be bothering with this entity system or be trying to use the new (but as far as I can see largely undocumented) component entity system?
-
If the TPCamera is not an IActor how should it be created? The ThirdPersonActor is created in OnClientConnect doing something like this: GetIActorSystem()->CreateActor(channelId, “Character”, “ThirdPersonActor”, Vec3(0, 0, 0), Quat(Ang3(0, 0, 0)), Vec3(1, 1, 1));
If you could shed any light, point me at any docs or code files I can peruse then I would be massively appreciative.
Thanks very much