OnComponentBeginOverlap Object rotation (over time) not working correct

Hi,
i’m trying to rotate an object by -90° on OnComponentBeginOverlap. But when my character enters the box collision, the object is rotating by -180° instead of -90°. Of Course i could set it to -45°, but it would still “feel” wrong…

I also tried to rotate the object -90° in 1 Second over time using a timeline and a Lerp. I’ve set the Alpha (Float) from 0 to 1 over a Lenght of 1, but the object was rotating more than -90°.
Actually its a constant issue i have with using the timeline to move or rotate objects over time from A to B. It always goes beyond the target, where it should stop…
What am i doing wrong?

Hi, well yeah Set Rotations in UE are pretty much useless, the only way for me to deal with rotation in Blueprints its through add rotation, try adding or decreasing 90 degress with AddWorldRotation instead.

PD: SetRotation auto manage your rotation from negatives and positives and blabla, weird behavior everywhere, that is why I always use Adds

Thanks for your answer! I’ve played around with it and had set up a Timeline with a Float Track from 0 to -90 degress in 1sec, split struct pin from new rotation and connected it to the NewRotation Z (Yaw). But when i’m using “AddRelativeRotation” the rotation went wild…

Have you checked if your Overlap Event fires multiple times?
You could use a Once node behind your OnOverlap to prevent your object from rotating too far.

OnEndOverlap you can reset your Once again, that should fix your issue.

Kind regards

Schnittbrot

Thanks Schnittbrot. This was helpful. But still, i’m not happy with the results… I could get it to work, to rotate it smoothly by -90 degrees.

But when i’m trying to do the same with location, it’s not working. How can i set this up with location instead of rotation. It’s really frustrating that a simple thing (moving from A to B in X Seconds) is nevertheless so complicated…

Glad I could help!
Your location approach isn’t bad, but there is an easier way than using a lerp + Alpha.
I suppose you intend to move your item a fixed distance.
For this you’d set up a new timeline, make a new track with a float value.

I chose the values time 0, value 0 and time 2, value 200.

This moves your actor (or any chosen) 2 meters within 2 seconds on the X-axis.
Hope this might help you.

Kind regards

Schnittbrot

Hey Schnittbrot, i got my location setup to work, but your’s indeed a bit better and the movement is smoother. Thanks for that!
Btw. if you didn’t knew it already, it is now possible to split struct pin from vectors and rotators directly so a Break vector or Break rotator isn’t always necessary anymore :slight_smile:

This question can be marked as solved. Thanks!