Changing a direction of a projectile's movement after hit

GustawVallian
Wed, 17 Feb 2021 18:59:58 +0000
C++

Hi,
In order to learn, I decided to make a Pong game in UE4. I decided that I will make my ball a projectile, so I can easily make it bounce by setting bounciness to 1. And everything works fine, but I want to change bounce direction of the ball after hit event if I’m moving my pawn and I don’t know how. I tried to rotate my ball so it will bounce in another direction, but it just doesn’t work. I was thinking about rotating my pawn’s hitbox but I think it’s too complicated to use, and just using if statements to check every second if my pawn and ball are in specyfic locations crashes UE4. My question is, how can I change the direction of ProjectileMovementComponent after a bounce, so, for example, if an angle between the ball and the pawn is 90, it will bounce with an angle of let’s say 130 instead of 90? And if it’s possible, I would prefer c++ help over bp.

1 post - 1 participant