Need help moving object using information fed in from Python

Hi guys,

I am developing a program in Python which is generating simulated 6DOF tracking data. I am generating a stream of numbers that represent X, Y, Z, Pan, Tilt, Roll and I would like to be able to move an object in Blender using this information. How would I go about writing a Python script to do this in Blender?

I would like to reinterpret this information as control information that blender would understand. I feel as though I’m missing something that’s key to my needs. I don’t particularly have an in depth knowedge of Blender, just basic stuff, so it could easily be the case that I’m looking for a common command that I’ve just not come across.

Thankyou in advance

Teryy Tortoise

Not much of a python head myself so there might well be better ways to do this but i’d imagine you use something like this;


allmydata = (0.1,0.2,0.3,0.4,0.5,0.6) #these values would be your rotation and location data

ob = bpy.context.active_object
ob.rotation_euler = [allmydata[0],allmydata[1],allmydata[2]]
ob.location = (allmydata[3],allmydata[4],allmydata[5])

Mind you, this rotation data is in Euler format, you can use math to convert to degrees or radians.