Reference ACharacter class from APlayerController class?
So I'm creating a top-down style game. I looked at the Top Down template, but I want to implement my own.
One thing I want to do is allow the player to zoom in and out with the mouse wheel. My ACharacter class contains a UCameraComponent that is attached to a USpringArmComponent so it's just a matter of changing the TargetArmLength in order to "zoom".
I want to handle all the player input in my APlayerController class. For me to zoom, I need to reference the USpringArmComponent from my ACharacter class. This is where I'm stuck.
I'm rather fluent in C++, but I'm still very new to the engine. I thought I could grab a pointer to the USpringArmComponent in my GameMode constructor, but that proved...difficult and resulted in weird casts that didn't even work (this is in my GameMode constructor):
I wasn't sure what cast to use (
If that is the case, how can I solve my problem of my APlayerController referencing the USpringArmComponent of my ACharacter class?
Or is there another more "elegant" way of implementing a zoom that won't require the player controller depending on the character class (probably not the best idea in the long run).
Thanks for your help.
You can grab your ACharacter derived class by using
answered Apr 04 '15 at 01:50 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here