x

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"

Access to bUseAccelerationForPaths from C++

Hi!

I can't access to UNavMovementComponent::bUseAccelerationForPaths from C++ code since it's declared as protected member.

 1>..\Source\MedievalTales\Characters\GameCharacter.cpp(44): error C2248: 'UNavMovementComponent::bUseAccelerationForPaths': cannot access protected member declared in class 'UNavMovementComponent'
 1>C:\Program Files\Epic Games\UE_4.16\Engine\Source\Runtime\Engine\Classes\GameFramework/NavMovementComponent.h(44): note: see declaration of 'UNavMovementComponent::bUseAccelerationForPaths'
 1>C:\Program Files\Epic Games\UE_4.16\Engine\Source\Runtime\Engine\Classes\GameFramework/NavMovementComponent.h(25): note: see declaration of 'UNavMovementComponent'

I have access to it only from Blueprints :( Please make it as public class member.

Product Version: UE 4.16
Tags:
more ▼

asked Aug 02 '17 at 10:08 AM in Bug Reports

avatar image

mdeni
40 7 14 22

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

1 answer: sort voted first

All you need to do is to extend the movement component in your code and set bUseAccelerationForPaths to whatever your heart desires, or even add an accessor function. No need to change engine-level code.

Cheers,

--mieszko

more ▼

answered Aug 02 '17 at 01:56 PM

avatar image

MieszkoZ STAFF
7.3k 225 57 413

avatar image mdeni Aug 02 '17 at 04:09 PM

Thank you for the hint :) I found excellent example in the source code of UnrealTournament (UTCharacter.cpp). BTW, Your twitch streams about AI are awesome! Can't wait next stream :)

avatar image kimducbk May 10 '19 at 01:13 PM

I am still stuck in this problem, Could you share your solution in detail

avatar image mdeni May 10 '19 at 01:23 PM

Hi! It's simple:

  1. Create you own component derived from UCharacterMovementComponent. For example:

    UCLASS() class MEDIEVALTALES_API UGameCharacterMovementComponent : public UCharacterMovementComponent { GENERATED_UCLASS_BODY() };

  2. Setup this parameter in constructor:

    UGameCharacterMovementComponent::UGameCharacterMovementComponent(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { bUseAccelerationForPaths = true; }

  3. Replace default character movement component by your:

    AGameCharacter::AGameCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))

  4. That is all.

avatar image kimducbk May 13 '19 at 02:02 AM

This solved my problems. Thank you so much bro.

Cheers,

(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