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"

Self Answering Question: How do I use AddForce on an APawn?

Disclaimer: This is mostly a self-made question and answer post, similar to a community wiki post on StackOverflow.

Question: How do I use AddForce() in an APawn?

Product Version: Not Selected
Tags:
more ▼

asked Apr 08 '15 at 12:51 AM in C++ Programming

avatar image

asperatology
293 31 30 91

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

1 answer: sort voted first
  1. Need this in the constructor:

    AMyPawn::AMyPawn(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass< UMovementComponent >(TEXT("Movement")))

  2. Make sure that SetSimulatePhysics flag is set to TRUE in both the class object (called either in BeginPlay() or in the constructor) and in the UE4 Editor (Properties/Details when you click on a (UBoxComponent, USphereComponent, UCapsuleComponent, etc. collider volumnes).

  3. Use AddForce(FVector Force of any vector) in your Tick(float Delta) override function.

more ▼

answered Apr 08 '15 at 12:55 AM

avatar image

asperatology
293 31 30 91

avatar image Wotaq Oct 11 '15 at 07:54 PM

Couldn't you have used ACharacter instead of APawn?

(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