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.
Asked
Active
Viewed 146 times
1 Answers
4
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:
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)
Seyed Morteza Kamali
- 961
- 7
- 22
-
1@RobinBetts thank you I fixed it – Seyed Morteza Kamali Aug 28 '20 at 08:24
-
AFAIC setting the matrix basis values absolutely (as above) and transforming are totally different. These are showing only the resultant local transform. Related eg rotating the cube in question image again around the view axis, or moving globally cannot be simply crunched into fields. In the most part initial values can be set when the object is created. – batFINGER Aug 28 '20 at 14:15
-
@batFINGER thank you for sharing! I didn't see this post – Seyed Morteza Kamali Aug 28 '20 at 14:30


