Download

Changing the orientation of an actor on holding a button

Hello to everyone,
I wanna explain a problem that i’m having difficult to solve. I have an actor that during a normal state he follow the orientation of a specific vector (Vector A) but when i hold a button, and I keep it pressed, the actor have to set up a new direction following another vector (Vector b) and when i release the button the actor come back to the previous vector orientation (vector A). I didn’t have problem to manage this the problem is that the change of the direction of the is instantaneous and, of course, i want it in a smooth way.

I follow the same logic as the blue print in attachment, but it doesn’t work. I think that there is some problem on the logic of the button pressed with the over time command. I realize that because i notice that if in the Lerp command i set manually the alpha to 1, the rotation work properly but not in smooth way…

Can someone suggest me something?

thank you in advance

I see a few things I would play around with:

First, try the Play from Start node on the timeline - it may not be resetting properly. Another thing to look at is the alpha…how long is your float curve?

And lastly, you are setting your actors rotation to Yaw: X, Pitch: 0, Roll:0, which may work fine, but you are always resetting the Pitch and Roll. I would use a GetActorRotation node and plug the current values into the Pitch and Roll nodes in SetActorRotation.

Hope this helps!

Hi.
Remember this: lerp or rinterp nodes MUST be used in tick event. Because if you want smooth rotation, you must update location/rotation every frame… another possible way is timeline… or set timer with fast-continuous firing… but imo best is to keep lerp in tick…