Ok I think its a good idea to first implement this with Blueprints and once you got everything right, adapt it to C++. Blueprints are much faster when it comes to prototyping.
Here is how I would try to achieve it.
I will create a new blueprint extended from Pawn. with the following general component setup.
- An arrow component as root (for visual purposes only)
- A spring arm under the arrow component (optional)
- A camera component under spring-arm (if you have it) or directly under arrow.
Setup the Axis and Action bindings.
The idea is to manipulate the position and rotation of the Pawn. Since the camera is attached to the pawn, it will move along with it. For instance, when I press ‘Q’, I will move the Pawn along positive camera Z axis. How you would move your Pawn is entirely upto you.
Once that is done, you might want to create a new Player controller and Game mode. Set this new Pawn as the default pawn. In the project properties, set this new controller and game mode as the defaults. Once that is done, when you press ‘Play’, you will be seeing through the eyes of this pawn’s camera.
Try if you can get it working. If you are having trouble, let me know and I will se if I can setup a demo for you (might take a day or two though, I am busy with some work)
Ok I think its a good idea to first implement this with Blueprints and once you got everything right, adapt it to C++. Blueprints are much faster when it comes to prototyping.
Here is how I would try to achieve it.
I will create a new blueprint extended from Pawn. with the following general component setup.
- An arrow component as root (for visual purposes only)
- A spring arm under the arrow component (optional)
- A camera component under spring-arm (if you have it) or directly under arrow.
Setup the Axis and Action bindings.
The idea is to manipulate the position and rotation of the Pawn. Since the camera is attached to the pawn, it will move along with it. For instance, when I press ‘Q’, I will move the Pawn along positive camera Z axis. How you would move your Pawn is entirely upto you.
Once that is done, you might want to create a new Player controller and Game mode. Set this new Pawn as the default pawn. In the project properties, set this new controller and game mode as the defaults. Once that is done, when you press ‘Play’, you will be seeing through the eyes of this pawn’s camera.
Try if you can get it working. If you are having trouble, let me know and I will se if I can setup a demo for you (might take a day or two though, I am busy with some work)
EDIT: I got some free time today. I set up a demo (not sure this is what you had in mind). I’m posting the compoenet setup and blueprints
Blueprint part1:
Blueprint part2:
With this setup, the camera will move when you hold Right mouse button and press W-A-S-D. It will rotate when you drag up or down. I have not implemented Q-E up-down. But its pretty easy to implement. If you are interested, I will try and post more screenshots