Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: UE 4.21
more ▼

asked Jan 09 '19 at 10:55 AM in C++ Programming

avatar image

3 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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!

more ▼

answered Jan 09 '19 at 06:30 PM

avatar image

1.2k 4 5 8

avatar image starrcat Jan 09 '19 at 06:52 PM

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. :)

avatar image the_batch Jan 09 '19 at 09:05 PM

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!

avatar image starrcat Jan 09 '19 at 09:15 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question