Created
April 21, 2015 09:59
-
-
Save apertureless/55b6350349aef8939ca0 to your computer and use it in GitHub Desktop.
Wheel animationscript for blender
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
# Wichtige Module importieren | |
import bpy | |
import math | |
# Variablen | |
dauer = 5 | |
strecke = 10 | |
durchmesser = bpy.context.object.dimensions.z | |
umfang = durchmesser * math.pi | |
# Berechnung der Umdrehungen | |
umdrehungen = strecke / umfang | |
print(umdrehungen) | |
rad = 2 * math.pi | |
# Ein wenig Schreibarbeit sparen | |
scene = bpy.context.scene | |
object = bpy.context.object | |
anim = bpy.ops.anim | |
# Timeline an den Anfang setzen und das Ende auf die Dauer der Animation | |
scene.frame_current = 1 | |
scene.frame_end = scene.render.fps * dauer | |
# Keys setzten und Reifen animieren | |
bpy.context.scene.frame_set(1) | |
object.location=object.location | |
anim.keyframe_insert_menu(type='Location') | |
object.rotation_euler[0] = 0 | |
anim.keyframe_insert_menu(type='Rotation') | |
bpy.context.scene.frame_set(scene.render.fps * dauer) | |
object.rotation_euler[0] = - (umdrehungen * rad) | |
anim.keyframe_insert_menu(type='Rotation') | |
bpy.context.object.location=(0, strecke, 0) | |
anim.keyframe_insert_menu(type='Location') | |
print(strecke) | |
# Zeiger wieder an den Anfang bringen | |
scene.frame_current = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment