# How do I determine if two hit normals are derived from a concave or convex surface?

**URL:** <https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [March 15, 2026, 11:12pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388 "2026-03-15T23:12:22Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 15, 2026, 11:12pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/1 "2026-03-15T23:12:23Z")

</div>

I need to determine if the player is wallrunning on a convex or concave surface, ideally by comparing two hit normals like so:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/0/b7098499fb522797a2a5461c215629ea905a3267.png)

I had hoped taking the dot product of these two would return a positive or negative value/angle, but that didn’t work, I assume since the vectors are always going to be pointing in roughly the same direction, they’ll never be negative. And I’ve been messing around with the cross product but I don’t see how getting a perpendicular vector would help me. I’m at a loss as to the best way to discern the difference here.

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [March 15, 2026, 11:43pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/2 "2026-03-15T23:43:19Z")

</div>

Try the dot product of each normal to the direction vector. Direction vector would be point1 - point2, normalized. If both products are positive, it’s concave as the vectors are “pointing at each other”. If both are neg, it’s convex. Mixed would indicate a nearly flat surface.

Edit: for point2 dot product, negate the direction vector… P2-P1

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 15, 2026, 11:51pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/3 "2026-03-15T23:51:11Z")

</div>

For clarification, is the direction vector player velocity in this instance? Or is this something I need to derive from the hit result?

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [March 15, 2026, 11:58pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/4 "2026-03-15T23:58:09Z")

</div>

It’s the hit locations. Hit 1 location is point1, hit location 2 is point2. P1 - P2 gives a vector that points in the direction between points. You want to check whether the normals are pointing at each other using this

---

<div class="post-metadata">

**Author:** ![dZh0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dZh0](https://forums.unrealengine.com/u/dZh0)\
**Post date:** [March 16, 2026, 1:05am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/5 "2026-03-16T01:05:23Z")

</div>

It is impossible to be done with the data from a single hit.

The minimum amount of traces is 3 in the plane (t1, t2 and t3). You need to get the angle between V1 and V2:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/e/f7e2ede62c803f859c98d78e57d6cf96a0027209.png)

You can use the Z of the cross product between V1 and V2:

V1 = t1 -t2

V2 = t3-t2

Z = (t1.x - t2.x)\*(t3.y-t2.y) _-_ (t1.y - t2.y)\*(t3.x-t2.x)

(Note that this is not the general case. There are shapes in 3D like [hyperbolic paraboloid](https://en.wikipedia.org/wiki/Paraboloid#Hyperbolic_paraboloid "Paraboloid") that are both convex and concave depending on your reference plane.)

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 16, 2026, 1:06am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/6 "2026-03-16T01:06:13Z")

</div>

> [@JGoodroad](#):
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/0/b7098499fb522797a2a5461c215629ea905a3267.png)

You can also use the cross product of the two vectors and check its sign against a reference up axis. If world up is (0,0,1) and both vectors lie in the horizontal plane (XY), then Cross(V1, V2).Z tells you whether V2 is to the left or right of V1.

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 2:30am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/7 "2026-03-16T02:30:09Z")

</div>

It seems like it’s never giving me a positive result, with boths dots are positive. And sometimes it says convex when it is.

Do I have this setup correctly?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/6/77633f31e5dac1625d651f824a7677d7ce822cfc.png)

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 2:32am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/8 "2026-03-16T02:32:08Z")

</div>

Wait, forgot to normalize. One moment. (Edit: Fixed. Normalizing the direction vectors still doesn’t seem to work so I’m assuming there’s another problem)

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 2:37am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/9 "2026-03-16T02:37:49Z")

</div>

Would this work when the z values of the two vectors change? The wallrunning in this case has gravity.

---

<div class="post-metadata">

**Author:** ![Countsie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/countsie/32/1194632_2.png) [@Countsie](https://forums.unrealengine.com/u/Countsie)\
**Post date:** [March 16, 2026, 3:13am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/10 "2026-03-16T03:13:55Z")

</div>

something like this:

 ![concaveconvexfcn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/c/5acd8259131e0bdce59d2dd1e0ac110a3d90d7d2.jpeg)

Though you would want to swap out \< with a \<= for the tests to account for dotproduct == 0

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 16, 2026, 4:19am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/11 "2026-03-16T04:19:43Z")

</div>

> [@JGoodroad](#):
>
> Would this work when the z values of the two vectors change?

Change as in one is lookin up?

What it important is that the inputs are two direction vectors in the XY plane.

Is that your case? Are the wallrunning zones always looking at the horizon or should it work with all directions?

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 6:44am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/12 "2026-03-16T06:44:01Z")

</div>

The Hit Locations of the two vectors can have varying Z values and the player can look anywhere they like during the duration.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 16, 2026, 7:48am UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/13 "2026-03-16T07:48:04Z")

</div>

All the cross product needs is the two normal vectors of the surface. That would be the impact normal from the trace hit.

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 6:33pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/14 "2026-03-16T18:33:19Z")

</div>

I’ve tried to replicate your solution here (Edit: Tried to make this clearer):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/8/828af40cd85c06595c31449d09c0b1918ee3cafb.png)

But it seems that regardless of the surface, the new dot is always negative and the old dot always positive. Meaning it interprets all walls as flat.

Now I expect, especially when on large walls, for it to sometimes read flat when it’s on a curve, but the Concave and Convex print statements never trigger.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/2/7e2ca2d2c5a0f36b9819fd6bd1c9e2c2c2106241.png)

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 16, 2026, 6:36pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/15 "2026-03-16T18:36:20Z")

</div>

I’m a bit confused here, can you show me a mock blueprint of what you’re talking about?

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [March 18, 2026, 4:46pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/16 "2026-03-18T16:46:58Z")

</div>

Sory for the delay.

> **Made this quick demo:**
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/0/ca053310b7fbcc259c59ffa6aa328ff99f23903e.jpeg)
> 
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/3/5a3e94874e9a411faf00b9068a8f82d501debc49.png)
> 
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/0/020b97638cfa85e54b27f9345a5b6244ecc92815.jpeg)

![Conc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/b/47bbc8ea053f5e9bab3133bc0d67bd336edfbff9.gif)

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 19, 2026, 6:53pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/17 "2026-03-19T18:53:33Z")

</div>

Well now that’s going above and beyond. I’m gonna have to try incorporating this after work.

---

<div class="post-metadata">

**Author:** ![JGoodroad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JGoodroad](https://forums.unrealengine.com/u/JGoodroad)\
**Post date:** [March 20, 2026, 7:36pm UTC](https://forums.unrealengine.com/t/how-do-i-determine-if-two-hit-normals-are-derived-from-a-concave-or-convex-surface/2706388/18 "2026-03-20T19:36:22Z")

</div>

Works perfectly! Thank you so much! Genius work here.
