TransWikia.com

How can I change the transform by minimal code?

Blender Asked by Seyed Morteza Kamali on January 27, 2021

I’m a beginner and I just want to set the location, rotation, and scale of the object.
I tried to get code by reverse engineering but when I moved, rotated, and scaled my object I saw complicated code.

enter image description here

One Answer

if you want to get exact code you shouldn't change transform in view port. when you change the transform in this panel it works:

enter image description here

enter image description here

Location

import bpy

obj = bpy.context.object
obj.location = (0,0,0)

Rotation

import bpy
import math

obj = bpy.context.object
obj.rotation_euler = (0,math.radians(90),0)

Scale

import bpy

obj= bpy.context.object
obj.scale = (1,1,1)

Correct answer by Seyed Morteza Kamali on January 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP