Can't smooth object rotation with mouse input

before i start, i have almost no programming experience and my understanding of blueprints is extremely basic.

Hi all,

I want to make an object rotate around on its own axis based on my mouse X/Y input.
I’m following a tutorial on youtube that shows a simple setup that works.

However, instead of the object rotating immediately when moving my mouse, i want to have a delay/smooth/damp (don’t known the correct term) when the object rotates. as if its smoothly following my cursor. After some searching around i found that Rinterp should do the trick, Unfortunately i cant seem to make it work. Now i think the reason it doesn’t work is because my current rotation value is the same as the target value, But how do i create a delay between these two values?

I’ve been banging my head over this for quite a while now even though the solution is probably quite simple, any help or tips are very much appreciated!

Rinterp works when one pin is the current position and the other is a fixed target position.

You’re right, in that interp will provide a smooth acceleration and deceleration between two values, but the target value must be known at the start.

What you have here is an incremental process, that’s why interp is not working.

If you want to see the correct effect, you’ll need to take mouse input as an indicator that the object must rotate by 90 degrees ( say ). Then you know where you’re going.

Thank you for the quick reply!

What would be the best way to turn the mouse input into an indicator? and would this still allow me to rotate the object around in realtime based on my mouse input. Maybe there is a better way to lerp/smooth the rotation while moving my mouse around?

Thanks!

Well, it just has to become a switch basically. So you’d make a stroke to the right, and the object would rotate 90 to the right. Like that.

I can’t think of a way you can have the object following the mouse with smoothing.

EDIT: I take that back. You have to de-couple the mouse movement and object movement.

So you could move the mouse to the right, and then the cube catches up. You could do that with interp. I’ll come up with an example…

Here:

321326-finterp.gif

Like I say, it’s really the fixed target that’s the main thing. There’s a million ways you could setup the input depending on whether you’re talking to a blueprint or it’s all happening inside a blueprint or…

The flip out is caused by something called gimbal lock. When you get to 180, the engine will map it to -180, and conversely.

Two ways to avoid it:

  1. Always add to the current rotation and never use absolute values ( then interp is out ).

  2. Use Quaternions:

If you know what you’re doing with C++ you can expose them to blueprint nodes also.

Excuse my late reply (european time zone)

Your example works pretty well! and got it to work with the Y input as well.
However, when i remove the clamp the rotation flips out and i kinda want it to have no limit to how many times it rotates around. Maybe i’ll just have to tinker a bit more. But this is a great start!

sorry i’m a 3D generalist, i know everything from modelling, animation to shading. But programming and blueprints goes way over my head but i’m slowly learning :’) . However i tinkered around a bit and found a fix!

Thank you so much!

(edit) I had trouble adding rotators together, after searching around a bit i found that the ‘‘combinerotators’’ node wasa thing.