Skip to content

Instantly share code, notes, and snippets.

@fwilleke80
Created May 4, 2021 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwilleke80/b38bafbbde8a95cf0ccadd22b526fc85 to your computer and use it in GitHub Desktop.
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.
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