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"

Pawn Movement component not moving.

I have tried to set up some code that makes the pawn move up when the jump function is called. When the function is called however , there is no movement , and I can tell the function is definitely getting called through the debug message.

The code is:

 #include "ClientMessage.h"
 #include "MyPawn.h"
 AMyPawn::AMyPawn(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Root")
     TSubobjectPtr<UStaticMesh> TouchCapsule = PCIP.CreateDefaultSubobject<UStaticMesh>(this, TEXT("Body"));
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Root")
     TSubobjectPtr<UPawnMovementComponent> myMovement = PCIP.CreateDefaultSubobject<UPawnMovementComponent>(this, "movement component", false);
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Root")
     TSubobjectPtr<USphereComponent> CollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, "collision component");
     CollisionComponent->bShouldUpdatePhysicsVolume = true;
     RootComponent = CollisionComponent;
     myMovement->UpdatedComponent = CollisionComponent;
 void AMyPawn::jump()
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("jump"));
     AddMovementInput(FVector::UpVector, jumpHeight);
Product Version: Not Selected
more ▼

asked Nov 11 '14 at 08:24 PM in C++ Programming

avatar image

3 6 6 9

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

2 answers: sort voted first

it looks like instead of AddMovementInput you should use SetActorLocation like in https://docs.unrealengine.com/latest/INT/Programming/Tutorials/PlayerInput/index.html

more ▼

answered May 22 '16 at 09:12 PM

avatar image

1 1

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

have you set this AutoPossessPlayer = EAutoReceiveInput::Player0; ? also do you have a PawnMovementComponent implemented ?

follow this tutorial https://docs.unrealengine.com/latest/INT/Programming/Tutorials/Components/2/

more ▼

answered May 22 '16 at 09:25 PM

avatar image

Mlody "Swidwin"
327 12 12 25

avatar image KLNHomeALone May 23 '16 at 06:20 PM

yes I set AutoPossessPlayer = EAutoReceiveInput::Player0; in the constructor

avatar image KLNHomeALone May 23 '16 at 06:24 PM

as for the PawnMovementComponent - I did not implement that, actually I tried, but something was not compiled, i'm a newby to C++, my whole life i've been working with .net and c# :)

avatar image Mlody "Swidwin" May 23 '16 at 06:48 PM

In your pawn movement component you have to override virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override Method its all in the tutorial

(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