# How can I get the surface normal's rotation in collision?

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915>\
**Category:** World Creation\
**Tags:** unreal-engine, Collision, projectile, question\
**Created:** [April 7, 2014, 10:18pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915 "2014-04-07T22:18:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [April 7, 2014, 10:18pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/1 "2014-04-07T22:18:27Z")

</div>

EDIT: Answer posted.

Hello,

I have a projectile that I have made stick to walls, currently behaving like the Medic’s needles from TF2 (sticking to walls at any angle it hits).

I would like to change it so that it will be perpendicular to the surface, AKA aligning to the surface normal rotation. I’m not sure how to go about getting that kind of data using Blueprint.

I’ve tried searching a variety of keywords in the context-sensitive menu by dragging a wire from the outputs of the “OnComponentBeginOverlap” node, but I can’t seem to find the data I’m looking for.

What would be a good way to go about doing this? Or doing something like applying a bullet hole decal after a ray trace? (which I assume also involves aligning to surface normal).

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [April 7, 2014, 10:24pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/2 "2014-04-07T22:24:39Z")

</div>

I dont know much about how a projectile is set but line trace gives you the hit surface normal information when you break hit result so you may want to look into that.

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [April 7, 2014, 10:31pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/3 "2014-04-07T22:31:52Z")

</div>

Hm, if returning surface normal info is unique the line trace, I may just have to do a short line trace after my overlap event fires. Thanks for the tip, I’ll look into that.

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [April 15, 2014, 3:49am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/4 "2014-04-15T03:49:36Z")

</div>

I found what I was looking for. I should have been using the OnHit event instead of the OnBeginOverlap event. OnHit returns hit info with normals and impact etc.

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [August 21, 2014, 5:14pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/5 "2014-08-21T17:14:35Z")

</div>

I’ve found the solution to calculating the angle of impact in blueprint, so I thought I’d come back here and post it for anybody who finds this question.

theta(angle between vectors a & b) = acos( dot(a,b) )

 ![13361-angleofimpact.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/4/e54a1b397b299049fdda478adb6d992859e06cca.jpeg)

So here I use a **Dot Product** node, and input the forward vector from my projectile, and the impact normal of the hit result (from a trace or hit event). Then I take the **Acos(degrees)** node to output the angle in degrees.

That’s it!

Then (if the angle is valid) to rotate the projectile to match the surface normal rotation at the location of impact, I first move the projectile to the point of impact, then use the **Find Look at Rotation** node to rotate the projectile to face the wall.

To make it look like the projectile sticks, you will also have to disable any movement and physics.

 ![13363-angleofimpact2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/3/8234bbbd1c92d552b5df9a758c331637cefa5c91.jpeg)

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [August 21, 2014, 5:29pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/6 "2014-08-21T17:29:23Z")

</div>

What I did to get my hit result was to trace a line every frame from my projectile’s location, towards its forward vector a short distance until it hit something.

 ![13364-linetrace.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/5/d054a735a2aeeb19ddda294af4fc3b6fdbe49783.jpeg)

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [August 21, 2014, 5:32pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/7 "2014-08-21T17:32:54Z")

</div>

Thanks for posting your solution!

---

<div class="post-metadata">

**Author:** ![Loki8Toki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/loki8toki/32/484886_2.png) [@Loki8Toki](https://forums.unrealengine.com/u/Loki8Toki)\
**Post date:** [November 18, 2015, 10:33am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/8 "2015-11-18T10:33:31Z")

</div>

dbInteractive  
Thank you very much for posting the solution !!!  
even after a year and a half that so helped !!!  
Thanks again !

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [November 18, 2015, 2:44pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-surface-normals-rotation-in-collision/279915/9 "2015-11-18T14:44:21Z")

</div>

No problem! I’m very happy to help.
