# \[HELP\] How to compute a bounce angle

**URL:** <https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, Blueprint, question\
**Created:** [March 29, 2022, 9:21am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564 "2022-03-29T09:21:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasGD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThomasGD](https://forums.unrealengine.com/u/ThomasGD)\
**Post date:** [March 29, 2022, 9:21am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/1 "2022-03-29T09:21:12Z")

</div>

Hello!

I am making a shooter and my bullet bounce. I am using the physic to do this.

I have a preview of the trajectory on press and shoot on release, this works. The issue is that my trajectory stops at the first wall and I have no idea how to preview the bounce!

Here is my predict trajectory: [Imgur: The magic of the Internet](https://imgur.com/a/vsCreJf)

I am quite new to the engine (few days) and I look up countless solutions that I either don’t understand, don’t know how to apply to my case or don’t work.

Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![NikDouglas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NikDouglas](https://forums.unrealengine.com/u/NikDouglas)\
**Post date:** [March 29, 2022, 9:37am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/2 "2022-03-29T09:37:27Z")

</div>

I am not going to comment on your implementation, but you should consider using something other than ‘Tick’ to do this to improve performance. On to your question: The OutHit struct contains what you need. Use the Impact Point and Impact Normal to create your new trace.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/6/bb694cc26cfbb99e9065ac2fc8c50bc33e6c739d.png)

---

<div class="post-metadata">

**Author:** ![ThomasGD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThomasGD](https://forums.unrealengine.com/u/ThomasGD)\
**Post date:** [March 29, 2022, 11:02am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/3 "2022-03-29T11:02:53Z")

</div>

Hey! Thanks for the answer; yes the implementation is bad and I should rework it true.

the solution gives me a static direction no matter where I aim: [Imgur: The magic of the Internet](https://imgur.com/a/q8S5H3c)

I try to have like a “pool” game display where you can see the bounces and all 🙂  
Thanks!

EDIT: [Get Reflection Vector | Unreal Engine Documentation](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Math/Vector/GetReflectionVector/)  
Yep fixed lmao

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 29, 2022, 11:09am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/4 "2022-03-29T11:09:49Z")

</div>

Try it like so:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/5/175587f609abad6f265b22d74e1d508ffc0298c6.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/3/be3e0d0c115028928008c9f9bbc56577a3152221.jpeg)

This would give up to X bounces as in the loop. We start at the yellow point.

Script to copy and clean up:

> **[Laser Bounce posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4](https://blueprintue.com/blueprint/fg5ivufe/)**
>
> No description provided

---

<div class="post-metadata">

**Author:** ![ThomasGD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThomasGD](https://forums.unrealengine.com/u/ThomasGD)\
**Post date:** [March 29, 2022, 11:17am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/5 "2022-03-29T11:17:13Z")

</div>

Looks pretty cool and way better than my “copy paste the same node”

Ill look into it!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 29, 2022, 11:30am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/6 "2022-03-29T11:30:20Z")

</div>

> [@ThomasGD](#):
>
> I try to have like a “pool” game display where you can see the bounces and all

I wouldn’t bother with optimisation at this point. If a game of Pool is the goal, you can keep the whole thing on Tick and never look at it again. But maybe you’re going mobile with this and every tick counts!

If you had 100 actors doing 100 sphere traces across 100 huge pool tables, that’d would be a very different story. Here you’ll have a single loop several elements long.

The easiest way to optimise it is to place a Gate behind the Tick event. Open the gate only when the player adjust the angle or there are balls on the move. Otherwise, the last trace result is not stale and can be used to visualise the trajectory.

If you’re going to visualise it with spline mesh components, do note that this can get costly. _Still_ unmeasurable and utterly negligible in this very instance.

Good luck!

---

<div class="post-metadata">

**Author:** ![ThomasGD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThomasGD](https://forums.unrealengine.com/u/ThomasGD)\
**Post date:** [March 29, 2022, 11:40am UTC](https://forums.unrealengine.com/t/help-how-to-compute-a-bounce-angle/510564/7 "2022-03-29T11:40:52Z")

</div>

Makes total sense, for now just enemies shooting at you and you can only fire one bullet by one and for pc. Just a side project to learn the engine!  
Thanks!
