Download

How to properly setup a custom Movement Mode?

I’m not a fan of those general question but after trying and trying with no success I just need someone here who knows how to do it to explain how I would actually do it.

Basically what I’m trying to do is the following: I need AI Characters with the CharacterMovementCompoment to “walk” in my landscapes using the flying mode, since this mode costs the least amount of performance. I don’t have any collision enabled on my AI, again because of performance, so I want to use RVO Avoidance. RVO however is not working in the flying mode, so I want to make a custom movement mode which is basically a one to one copy of the flying mode with RVO updates included. I already found all the code and functions I think I will need for this. However I can’t figure out how to actually set the custom movement mode up.

I’ve created a new C++ class derived from the character movement component. In there I override the function PhysCustom() which would be my Custom Movement Mode. I don’t need more than one custom mode.

However now starts my problem. I can’t delete the standard Movement Mode from a character class and put my own in it. So as far as I understand I have to create a class which derives from the Character class and override the constructor to to load my new Movement component instead. I’ found an old wiki article that explains this part but it seems to be outdated because the code doesn’t work anymore. So all I”m really asking for is, how do I need to write my character class to properly use my custom movement component? Maybe the wiki does work and I’m just missing an include? Here is the article to this: https://answers.unrealengine.com/que…ment-mode.html This is the approached I tried but it’s clearly outdated and doesn’t compile like this: I’m basically looking for this part:



APlayerGhost::APlayerGhost(const class FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UClimbingMovementComponent>(ACharacter::CharacterMovementComponentName))

That compiles fine for me, I’ve also got a custom movement component. What errors do you get when you try to compile?

Since I got even more responses that this should compile just fine I went through everything again and actually found an error in the header. All errors I got pointed to the quoted part though. But I got it to compile too now.

Since you are working with custom movement modes too. Do you have an idea what I would need to get RVO avoidance working in any movement mode? I wanted to start with my custom movement by simply copying the flying mode and add RVO to it and go from there, however I can’t make out why RVO is working in walking mode but not flying.

Sorry, I wouldn’t know myself as I’m using my component for a regular character. Have you tried asking in the Discord? You can get an answer pretty quickly during peak hours.

https://unrealslackers.org/

Didn’t know there was a discord. Thanks I’m definitely gonna join that