Add some randomness to the velocity when a ball bounces using UProjectiile Movement Component

ViaCognita
Tue, 31 Aug 2021 07:37:26 +0000
World Creation

I’m developing a clone of Arkanoid and I’m using UProjectile Movement Component to move the ball.

When the ball hit something it always bounces to the same direction. I’ve been checking UProjectileMovementComponent::ComputeBounceResult code to see if I can add some randomness to the velocity returned by the method, but I don’t think so.

For example, if the ball moves with (0, +y, +z), it will bounce to (0, +y, -z). I want to add some randomness to the z value. Something like (0, +y, -0.8z).

Is there is anything I can use it?

Maybe, I can use the method UProjectileMovementComponent::AddForce.

1 post - 1 participant