Cover system on curved surfaces

Hi! I have been working on a cover system and gotten quite far. However I have run into a problem. I use linetraces to find a cover and use the hit location to set the characters position and the hit normal to set the rotation. The character can also move along the surface as it should. While in cover the character shoots a linetrace, with the opposite direction of the latest cover normal, every frame. The hit information updates the rotation and position ever frame. However a problem emerges when taking cover behind convex surfaces. When the character reaches the edge of a face and hits a new face, it changes the rotation to align with the new face. But with this new rotation the next linetrace hits the old face so the rotation is set back. So the rotations switch between to values at 60 fps so the character starts jittering. I hope I managed to explain sufficiently the problem that I am facing. I have been trying to solve this for a long time but haven’t been able to solve it yet. Does anybody have any smart suggestions?
thanks for your time :slight_smile:

It’s very hard to understand your problem without screenshots. At least one with rotation setting and hit calculation

try RinterpTo, instead of instantly turning.
use more than one trace, then average the results.

The way I see it, an average would just minimize this problem not fix it. The undesired effect would still be noticable. RInterpTo did not help at all

Hi, I managed to get a decent result when using RinterpToConstant by using the velocity as a factor in the interp speed. It didn’t work before because of another part of the code which I changed. Thank you for the help! :slight_smile:

The problem could be at the trace start and end. Show us more)

While we check your code I could help you with common logic. When the character finds angle by casting traces and checking normal changes, you should change not only rotation but location to. Move character to new snapping position. And while you so that skip normal checking.

I’m not sure it helps you every time.

On sharp egdes

Why instantly?? Move by spline with Interp. And I advise you skip rotation checking until you move around corner.

I did try that earlier but it did not work for some reason. Furthermore this would require the the location to be changed instantly which would not look good at all, or it would have to change the rotation and location at exactly the same rate which I suspect could cause bugs. Thank you for your reply but I believe it to be solved :slight_smile:

when would it not?

You didn’t say that)

whatever) hope you never stuck in your work. good luck!

I doesn’t need to work on any angle that is sharper than 70 degrees or so. since that would count as the edge of the cover.

the solution I have now allows me to change the rotation and the location simultaneously which looks alot more fluid than changing one after the other.

no sorry about that. That is usually how cover system work though.