Orienting objects using python script

Hey all,

I am new here. I have just now started learning python scripting in blender.

I am making a animation where cars are placed in a crossroad (just placed not moving). The number and position of these cars are taken as input from user. And here is one more car (namely “Hero”). This car, when given the initial and final position, solves the maze and show the animation accordingly.

My problem is, at the beginning I have written a function to place all the obstacle cars at origin and hide them.

I want to know the command to make them point in the same direction.
And I also want them to face in the direction according to their position in the road. I tried a lot but I am struck and don’t know the command for that also.
Is there any command or function similar to “ob.location.xyz = " ( here “ob” bpy.context.scene.object[”…"]) so that i can have it in the orientation I like.

Thanks in advance for the help.

A Arun

You can set the objects rotation several ways. For example you can set the objects rotation with this property. However any parenting may cause issues.


Best is probably to build the object’s world matrix from scratch by combining a scale, rotation and location matrix.


1D scripts can do so, check github and youtube for them. there are many features