Download

Proper way to create new C++ character with custom movement.

I’m sorry if this is posted in the wrong section of the forum I’ve never posted anything before so I wasn’t sure where to put it.
I am having trouble figuring out the proper way to create a custom character with custom movement via c++. I’m sure this has been answered before but I can’t seem to find anything on it.
I have tried so far starting with the c++ Third person template and subclassing the Character movement component but it’s turning out to be very complicated and it feels like there must be a better way to do this.
Am i doing the correct thing by subclassing the component or am I just supposed to use the component and write custom code in a subclass of the Character or is there something else I’m missing ? I have tried looking at Ramas Tutorial for custom movement components but it’s very old and I’m not sure if doing it that way would keep the functionality of the third person template.
Thank you for your time and answers.

Hello,
I am also searching a way to do these kinds of stuff. For the moment I found that you will need to create a plugin in order to create a new class, deriving from an existing one. I have tried it myself but there were several errors in the compilation of the code :stuck_out_tongue:

I think there is a way to do this by creating a plugin. Maybe there are some kind of tricks to do…

Modifying pre-existing classes will be infinitely easier than starting from scratch. Infinitely easier. You’re essentially going to reinvent the wheel from scratch versus having a Ferrari already built that you can modify.

MikeRPG right that is what I believed which is why i started it that way, however, I went over the c++ code from the engine on the CharacterMovementComponent.cpp and it just seemed very complicated to try and overide only specific areas so that I could keep the original functionality while adding new ones. Do you know any way to do this like what functions to override and re call etc ?
Space-Bird I’m not sure making a plug in would be the way to go for this ? Maybe it is but I haven’t seen anything to indicate that ? Why do you believe that is the correction method of approaching this ?
Thanks everyone and sorry if this is very basic stuff.

Plugins have nothing to do with this.
And the wiki is correct, that’s the way to do it. But for that the GENERATED_UCLASS_BODY macro is mandatory; you can’t use GENERATED_BODY() and expect the wiki tutorial to work.

BrUnO XaVIeR I see that is probably want my issue was then. Thank you. I will give it a try tonight once I get of my day job.

Your best option is have a clean engine that you can tear apart and mess up because you’re going to mess up. From a fresh engine make a copy of the charactermovementcomponent.cpp and the .h and then just start trying to implement new features. You’re going to have to get your hands dirty and there’s no way around it.