This may be very simple, but I just cannot wrap my head around putting together equations.
I managed to put together a blueprint structure that makes the actor look at the mouse cursor with a limited rotational speed, all from the help of this community of course, but now I would like to enhance this feature by giving the rotation some acceleration when starting to rotate, and deceleration when coming to a stop.
But I have no idea how and where to construct this equation, please would appreciate it if someone can show me how through samples of blueprints, because just typing it would most likely confuse me.
This won’t be simple at all! And it’d really be an overkill to have your custom acceleration & decceleration values since it’s very unlikely for them to be noticed in the first place. Why don’t you use FInterp Ease in Out like this:
The sample you showed me is very close to what I’m looking for. I want to be able to control the maximum speed as well, meaning I want to feel that the actor is reaching a maximum speed of rotation even if it may look rigid, I hope I’m not being too demanding.
I appreciate your replies
You can promote the Exponent pin of the node into a variable like I did, and adjust its value between 0 and 1 (ideally, if you’re plugging the world delta seconds into the Alpha pin)
I tried the method you recommended, but now my character is not rotating anymore.
I have to mention again, I hope that you can explain things like I am a 2 year old, embarrassing as it may sound, there are some math terms like “Exponent” that I forgot what they even mean.
That controls the interpolation speed. Like I said, since you’re plugging the world delta seconds into the Alpha pin, the ideal range of the Exponent value would be 0 to 1. It’ll get really slow after that, and just stop past 2. In my example, it was set to 0.75.
Okay now I understand, but now I have a new problem, it looks like there is a 360° limit to the node FInterp Ease in Out that causes a flip at a certain point in the world space, I realized that Rinterp to Constant solves this issue by “split struct pin”, all I could guess that the B pin input in FInterp Ease in Out could maybe be modified somehow I donno,
I can only hope you keep replying your the best Vis!
Oh right… I missed that part when I tried it myself due to the camera angle, my cursor was always infront of the actor.
You could fix that easily with a Lerp (Rotator) node, (or just use a Rinterp node) but then you couldn’t have the Ease in Out effect, they either ease or are constant. So you’ll need to handle it manually like this:
Unfortunately I’m not on PC right now, so couldn’t make it from scratch for your specific use case but rather used an older screenshot of mine. But it shows how the math should work!
So in your case, you should first save the result of the Find Look at Rotation node inside our TgtRot variable, then do our calculation, and then perform the interpolation using the variable.
Ok the Lerpe (rotator) node worked in a 360 fashion without the flips which is great, but I still am not able to control the max speed and rate of acceleration/deceleration.
I applied the equation on the Rinterp node, but I think I did something wrong.
The actor didn’t rotate at first, but then I started experimenting with the values and realized that changing the highlighted > node to 0 got me back to where I started and rotating with no accel/decel.
I feel like I’m almost there. Basically the mechanic I am trying to achieve is lets say the actor is rotating while grabbing a heavy object, and so depending on the weight of that object, I want to be able to control the speed and behavior of rotation. I hope that helped.
Correct me if I’m wrong, but I feel like I just need these values to manipulate:
1- Acceleration rate
2- Deceleration rate
3- Max rotation speed
4- Angle threshold (a rotation value that triggers when to start to speed up rotation and slow down depending on cursor position)
Not required here, as you can control both acceleration and deceleration by adjusting the Exponent value. Here’s what it looks like when it’s set to 0.75:
And here it’s set to 0.5:
But it’ll get really complex if you seriously want to control the acceleration, deceleration, and max angular speed accurately.