I want to make a to and fro motion on x using a sinusoidal equation. I saw it on a tutorial recently but i can't find it again.
-
$\begingroup$ Something like the ping pong node youtu.be/9y0HHYD7Lxo $\endgroup$– Rick TCommented Jul 16, 2023 at 16:55
-
$\begingroup$ using python? blender.stackexchange.com/questions/270888/… $\endgroup$– Harry McKenzie ♦Commented Jul 17, 2023 at 10:09
2 Answers
Add a location keyframe for your object anywhere by hitting I in object mode and choosing Location.
In the Graph Editor select the keyframe for the X value, then go to the properties panel (hit N if you don't see it).
In the Modifiers tab choose Add Modifier > Built-In Function
Click the object's X Location to edit it, and type in #sin(frame/20)
.
This will create a driver with a scripted expression sin(frame/20)
which sets the X location to the SIN of the current frame value divided by 20. Making the cube move on X between -1 and 1 every ~63 frames.
-
$\begingroup$ Hello, could you please tell a bit more? $\endgroup$ Commented Jul 17, 2023 at 13:46
-
$\begingroup$ A simple back and forth. Or up-down continuous motion. $\endgroup$ Commented Jul 17, 2023 at 18:13