-1
$\begingroup$

How to set pivot point location through python?

for example:

object[name].pivot_loc[0] = 0.1
object[name].pivot_loc[1] = 0.5
object[name].pivot_loc[2] = 1

I decided to do so...

bpy.context.scene.cursor_location = (0.0, 0.0, 0.0)
bpy.data.objects[name].select = True
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
$\endgroup$
3
  • $\begingroup$ Are you talking about a rigid body joint constraint blender.org/api/blender_python_api_2_76_1/… $\endgroup$
    – batFINGER
    Commented Apr 6, 2016 at 4:49
  • $\begingroup$ "For use with the Game Engine" - or not? $\endgroup$
    – Alekhly
    Commented Apr 6, 2016 at 5:23
  • $\begingroup$ How to access the object through RigidBodyJointConstraint? $\endgroup$
    – Alekhly
    Commented Apr 6, 2016 at 5:29

1 Answer 1

0
$\begingroup$

Here is how to access RigidBodyJoint thru bpy

import bpy
context = bpy.context
ob = context.active_object

rbjs = [c for c in ob.constraints if c.type == 'RIGID_BODY_JOINT']

for rbj in rbjs:
    print(rbj.name)
    print(rbj.pivot_type)
    print(rbj.show_pivot)
    print(rbj.pivot_x)
    print(rbj.pivot_y)
    print(rbj.pivot_z)
    print()

If you know the name you can access directly with

rbj = ob.constraints.get('Rigid Body Joint') 

which will return either the constraint or None if there is no constraint with that name.

$\endgroup$
2
  • $\begingroup$ Um... Was this accidentally posted on the wrong question? I don't see anything about ridged bodies here... $\endgroup$ Commented May 7, 2016 at 4:04
  • $\begingroup$ Last comment of the OP on question. $\endgroup$
    – batFINGER
    Commented May 8, 2016 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .