New movement ability for character (Multiplayer)

Hi, everyone!

I’m trying to add a new movement ability (teleporting) for my character, created by Third Person Sample Project. I’m following the Approach 4 from this Character Movement Component article. Using a C++ project, i’ve created my own child class from UCharacterMovementComponent. But i don’t have any idea how to connect it with my Character class. Can you help me?
P.S. I’ve found this question and my code is pretty much close.

Thank you!

Oh, luckily, that’s easy!

Have you seen this article on the UE4 wiki? Custom Character Movement Component

It call comes down to using the FObjectInitializer within your character class’s constructor to tell your character to be initialized with your custom movement component. Specifically, the FObjectInitializer::SetDefaultSubobjectClass function will do the magic for you.

Take a look at that wiki page, and look up how the FObjectInitializer works if need be. And let me know if you want me to explain things a little further!

Thank you very much for your answer!
I’ve done this with FObjectInitializer about 1 hour ago and now i’m stuck with another problem: how to add a teleporting ability to my custom movement component. If you have some experience with problems like this, it would be great if you can explain it for me.
Thanks again and sorry for bad english. :slight_smile:

Thank you! I’ll read carefully both articles tomorrow and then try it by myself. And i’ll mark your answer as correct, it should be helpful for anyone else. Maybe, i will leave some comments about my progress here. Thanks a lot!

Happy to help. And your English is actually quite good, so no worries!

I don’t have any first-hand experience with implementing a network-ready teleport ability, so I don’t have any unique advice to offer. From what I understand, it’s a bit tricky to get right, but it’s certainly doable if you’re determined.

I did find the following two resources, which I hope will help you. Both show some code examples on how to complete this process — particularly how to override the AllocateNewMove function.

How to Properly modify the CharacterMovementComponent for Networked Games (from the UE4 forums)

Authoritative Networked Character Movement (from the wiki)

Once again, I hope those help you get your ideas up and running!