Created
May 4, 2021 13:53
-
-
Save fwilleke80/b38bafbbde8a95cf0ccadd22b526fc85 to your computer and use it in GitHub Desktop.
C4D Sinusoid plotter: Copy code into a Python tag. It will move an object in circles and loops.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import c4d | |
import math | |
FREQUENCY_X = 2.5 | |
FREQUENCY_Z = 1.8 | |
OFFSET_X = 0.5 | |
OFFSET_Z = 0.0 | |
AMPLITUDE_X = 100.0 | |
AMPLITUDE_Z = 100.0 | |
MULTIPLY_Y = 20.0 | |
def main(): | |
obj = op.GetObject() | |
current_time = doc.GetTime().Get() | |
x = math.sin(current_time * FREQUENCY_X + OFFSET_X) * AMPLITUDE_X | |
y = current_time * MULTIPLY_Y | |
z = math.cos(current_time * FREQUENCY_Z + OFFSET_Z) * AMPLITUDE_Z | |
result_pos = c4d.Vector(x, y, z) | |
obj.SetRelPos(result_pos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment