How To Rinterp Mesh Properly?

I have my mesh rotate the opposite direction on a flip flop, it takes the forward vector of the mesh’s world rotation and negates it so it will get the opposite direction regardless of its rotation.

My problem is I would like to rinterp this so the rotation from its initial rotation to opposite rotation is smooth otherwise the character’s mesh just flips to the opposite direction instantly and it’s not the look I want to achieve.

Any help would be appreciated on how I would go about achieving this thank you!

Instead of rinterp I ended up lerping the roll pitch and yaw that derived from the rotation of the forward vector of my mesh, I used a timeline to control the alpha of the lerp and it works smoothly now.

actually upon further gameplay with it, it seems it doesnt account for the rotation while moving any ideas on how I can correct this?

I set the forward vector on button press so it only sets that frame, is there anyway I can account for the movement and change in variable?

hi Jinkuu, I think it is fixable… would you please attach a screenshot of your current blueprint?

I removed the roll and pitch lerp since I didn’t really need it for my rotation but the problem is still the same.

Ok so I made an update to the rotation system instead of getting the forward vector and negating it at the start I made two arrow components at the front and back of the character, it then gets the look at rotation from the mesh to either the front arrow or back arrow and lerps that rotation.

There is a new problem though as the character mesh will jiggle/vibrate out of control sometimes will moving during the rotation I assume it freaks out like this because its getting a new look at rotation whilst rotating but I’m not sure.

I’ll put the blueprint here hopefully I can fix this but it does work a lot better than what I started with.

hi Jinkuu… I think you are right…

It seems like you rotating the mesh independently of your character with Set World Rotation… which is totally fine… but it’s best to use the Set Absolute Rotation node in Begin Play on this component… to nominate it as world rotationally independent component.

in general… and this is just my opinion and there are probably ways around it… but I’ve found Lerp works best in a more static situation where the start location/rotation doesn’t change during the transition. If the start location is dynamic, I’d go back to using Interp

It looks like you’d like to keep normal control of your pawn, but smoothly rotate the child mesh component 180 degrees every now and then. If I’m right, there is a MUCH simpler way of doing it… you can delete arrows and the get look at rotation, also don’t use Set Absolute because you’d like to keep the parent/child rotation relationship: use Set Relative Rotation with a rLerp or rInterp to change the position as needed). If it’s just a static 90 degree rotation every now and then I’d use rLerp). Give it a try and come back here… I’m fairly sure we can get this fixed up.

When working with rotators, generally do your best to avoid breaking them into structs, manipulating the float angle and reassembling them as rotators. Rotators seem to have special handling in-engine… such as when the angles go over 90, 360 and 180.

Thank you so much! I was able to rLerp the relative rotation and that worked out perfectly

well done! you are very welcome… happy to be useful :slight_smile:

Quick addition to this, if I wanted to have multiple rotations with the angle going over 360 , 720 etc how would I go about rLerping it? it seems when I try to rotate past that amount the rotation freaks out.

ah… I know exactly what you are speaking of and this can a bit awkward… honestly I haven’t really needed to look into this situation… so I don’t have an elegant solution for you… but I’d be really interested if you’d post a solution here if you come up with one… sorry I can’t be more helpful :frowning:

It’s cool I’ll be sure to update you if I find something. You’ve been a great help so don’t worry about it!

I was able to achieve this by setting the meshes relative rotation as a variable before lerping it.