How can I smoothly rotate my puzzle?

Guys, how can i smoothly rotate my puzzle?
I can’t add timeline inside a function… and putting it outside the function in the event graph it’s not accurate with the code, it all goes wrong… how can I do this smooth rotation instead of the raw direct rotation? The set value of rotation is 90 degrees
If anyone can help me I would be very grateful



Why does it have to be in a function?

I don’t need it, it’s just that I don’t know how to do it in a precise way… I tried to use the timeline linked to the rotate value (90 degrees) but it rotates wrong… it rotates several times more

I’m wondering if you’re using ‘add relative rotation’ with the TL, that won’t work.

The way to do it is

1 Like

ahh I understand, I don’t necessarily need to leave the relative rotation part inside the function… I can remove it and use it in the event graph and the puzzle won’t lose functionality… it’s just that I’m learning from a tutorial on youtube and the guy did it like this , then I’m trying to adapt
thank you!!!

the problem is that separating it, it doesn’t check the code to unlock the chest

Show me that bit of code.


now the first rotation when I click rotates correctly, then the timeline stops working and is limited to only rotating each piece once… I’m confused

Looks like you are using the same timeline for all circles.

at first i thought that defining the target as the components, it should work, because it’s a relative rotation of the position they meet

Also, maybe play from start instead of play. Because timeline finishes.

it almost turned out very correct putting play from start, but it resets the animation and pulls it abruptly to the beginning… I would like it to continue the rotation from where it is stopped :confused:

Rotate indefinitely left/right or just 90 degrees once after interaction?

I would like it to rotate 90 degrees for each click on the component

if I remove the timeline, it works fine… when I put the timeline, it does some multiplication that I don’t need, if I put values from 0-1 in the timeline, and set the lerp to 90 and put it to play from the beginning, it spins countless times more

Then you would have to check in which quadrant each component is and use
360 degrees with those timeline set new time, new time, stop functions.
Here is some more help:

and

image

I’ve always found this function quite useful

Imo to use timelines its best to have it in a seperate actor instance so they can work together. Did a quick test (and accidentally made the entire thing) making a blueprint for the knob and another to spawn the knobs and manage them.

The knobs:

This is how I manage the knobs:

In this actor I have an int array (iUnlockCode) with the unlock positions used to compare.


Result:

KnobPuzzle


With this I can set different unlock codes per instance including directly affecting the amount of knobs:

image

image

KnobPuzzleMulti

Hope it helps.

2 Likes

Thank you very much for your time and for making a more complex explanation, I’m new to developments, it’s my first game… I’m still learning… I’ll try to study what you went through to understand how it’s working!! Thanks!

1 Like