Skip to content

Instantly share code, notes, and snippets.

@hsaito
Created April 12, 2022 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsaito/6c6a3215dbd08cbec7867f407dd0a07d to your computer and use it in GitHub Desktop.
Save hsaito/6c6a3215dbd08cbec7867f407dd0a07d to your computer and use it in GitHub Desktop.
import bpy, csv
data = "FILEPATH"
current_scene = bpy.context.scene
target_object = current_scene.objects["Env"]
scale = 100
interval = 1
current_frame = 1
with open( data, encoding='shift_jis' ) as csvfile:
reader = csv.reader( csvfile )
for i, row in enumerate( reader ):
if i < 8: continue
x, y, z = row[0:3]
x = float(x) / scale * -1
y = float(y) / scale * -1
z = float(z) / scale * -1
target_object.location = (x, y, z)
target_object.keyframe_insert(data_path="location", frame=current_frame*interval)
current_frame += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment