How can I change the period of oscillation of an object?
Hi there, thanks for looking at my question! I have been learning C++ for a month or so to try get a handle on it for general use but also to have a better understanding when I started learning Unreal. I am in the first C++ unreal tutorial where toy make a floating Actor that bobs up and down and I understood it, but at the end it asks you to add 2 more axis of movement at different rates. I thought I had the answer but I see now that I was just increasing the value of Sin by multiplying the delta time by a different amount for each direction, which increases the length the object moves, but it takes the same time in all directions, resulting in a vector motion. What I want is for it to take different amounts of time to complete a full cycle in each axis so that it looks like it is bobbing about in all directions.
So for example I want it to move up and down once fully every 3 seconds, back to front every 2.5 seconds and side to side every 4 seconds. I hope that is sort of clear. Can anyone help?
(comments are locked)

It very easy if you think about it, you just scale the flow of time so for example:
Will move twice as fast :) If you want to accurate cycle per sec you need also multiply frequency by PI*2 (*2 make it full cycle, look link) https://betterexplained.com/wpcontent/uploads/sine/sineplot.gif
if you want sec per cycle you invert the scale (1/x)
But note as you use adding to position, change of frequency and aspecially amplitude can cause displacement of the actor, if you want it to be consistent use setting insted of adding, i think changing frequency sould not be a issue if you scale time just at delta time Thank you so much! I knew it was something simple but my brain wasn't working. I was putting the modifier in the wrong place. Thanks! Sorry to resurrect this old post but I'm confused why the whole You right he could just do
(comments are locked)

Follow this question
Once you sign in you will be able to subscribe for any updates here