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"

How do I make my pawn hit PhysicsActors "harder"?

The math behind movement and controls in my game is pretty complicated, so I'm using AddActorWorldOffset to do movement, with a custom collision class. It works, colliding with objects gives me that subtle bounce-off that I'm looking for, and physics actors are affected by being hit.

I just want them to be affected more. I want the same velocity of impact with my pawn to push them harder, make them fly away faster, and I have no idea what to change to tweak this.

My movement:

 void AFlightTestPawn::Tick(float DeltaSeconds)
 {
     // [ Derive DeltaRotation and CurrentVelocity ]
     
     AddActorLocalRotation(DeltaRotation);
     AddActorWorldOffset(CurrentVelocity, true);

     Super::Tick(DeltaSeconds);
 }

And my collision logic:

 void TestPawn::NotifyHit(class UPrimitiveComponent* MyComp, class AActor* Other,
 class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal,
 FVector NormalImpulse, const FHitResult& Hit)
 {
     Super::NotifyHit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalImpulse, Hit);
     
     CurrentVelocity = CollisionBounceFactor * (FVector::DotProduct(CurrentVelocity, HitNormal) * HitNormal * -2.0 + CurrentVelocity);
 }

To be clear, I like how my pawn is reacting to the collision, I want the static mesh that the pawn hits to react more violently.

Product Version: UE 4.17
Tags:
more ▼

asked Dec 03 '17 at 10:57 PM in C++ Programming

avatar image

ArdentStoic
1 2 4

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

1 answer: sort voted first

OtherComp->AddImpulse( ImpulseVectorYouWant, ... );

more ▼

answered Dec 04 '17 at 12:24 AM

avatar image

Nachtmahr
7k 143 28 172

(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