My Question is whether what I do make sense, because it feels like ugly programming.
I believe there should be a better solution than what I arrived at.
In my RTS game, I want to be able to move the camera freely -using FloatingPawnMovement- while the middle mouse button is held down.
While the mouse is not held, mouse movement should not change the camera, however pressing wasd will move the camera.
The way I am currently doing this is by having two different Actors, one with the FloatingPawnMovement and the other without, and the PlayerController will unpossess and destroy the current actor, and spawn and possess the other, when the middle mouse button is pressed / released.
I have been tinkering around this for a while now, and this is the first result that actually worked out (I was disabling tick on the movement component before…).
If I can solve this in C++ that’s perfectly fine too, I tried to extend FloatingPawnMovement, but I didn’t manage to figure it out…
Hello Flash,
the issue was that when I disabled ticking for the movement component, the camera would still rotate when I moved the mouse. I couldn’t find a way to disable just that.
I’m not on my work computer until monday…
I’m using Unreal’s FloatingPawnMovement component because it is the exact movement I want to use. The Camera is attached to a DefaultPawn, other than that it’s empty.
Alright, I’ll do that once I get home.
But for the FloatingPawnMovement Component, I enabled the default movement bindings, so for the freecam, I do not handle input manually.
(this image is from another unreal forum post)
Yeah that would definitely make sense.
Is it simple to define the input then? I had a quick look around for that before, but I don’t remember seeing it.
I really want to avoid having to basically rebuild the exact same behaviour
Alright I managed to create the behaviour I wanted, I just had to create my own input events, as Flash7 said.
For everyone who doesn’t know how to do that here you go:
(note this was done on a fresh DefaultPawn)
Step 1:
Create the Axis you want in the Project settings.