Private members in the engine source
I'm looking at overriding some behaviours specifically on the CharacterMovementComponent, but I see in Character the CharacterMovement member is declared as private. This prevents all extensibility, which doesn't make much sense to me.
In effect I'd like to use my own Movement component (extended from CharacterMovementComponent), and then override some behaviours. I can understand that the encapsulation principle dictates that it shouldn't be possible for outside entities to change the internal state of this member, but surely it shouldn't prevent the use of an extended version of the member class? I'm referring here to the fact that I extend both Character, and within its implementation I'd like to use the movement component I extended from CharacterMovementComponent.
The Character class' movement was implemented against the "interface" of specifically CharacterMovementComponent, so using components derived from it would pose no issue (other than obvious bad usage) so what is the purpose of preventing this extensibility?
I would really appreciate an explanation regarding the logic behind making this member private (instead of protected). The same applies (to a lesser extent) to the collision component.
It's very possible that my inexperience is at fault here and I'm missing something obvious, but I can't understand why access is limited so severely in this case.
asked Apr 24 '17 at 11:56 AM in C++ Programming
I think they made it private because there is need to make it protected. When you want to use your own movement component, simply do:
You can do the same with a custom capsule component.
answered Apr 24 '17 at 04:28 PM
just fork from github master, make the change, submit a pull request, and use your own fork in the meantime. unreal with all its deps, is easy to recompile with just a couple commands (on linux). there is little stopping you from making small changes to the core engine like this.
answered Apr 24 '17 at 03:55 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here