Home Technical Talk

Python for maya - creating joints

Hey guys, my first post. ive tried to search for my problem but it seems very unique and i cant find anyone who can fix it. I am attempting to create a basic auto rigger for a vehicle to use with udk. but im at the start. Im trying to create a joint at the center of a wheel, but when I use the code I have made, it spawns the joint at the center of the grid, I do have the wheel selected, and yea the wheel has its pivot centered. when I use the same piece of code in a new scene on a sphere or cube etc, it works perfectly fine. I have tried exporting as obj and re-importing to get rid of any errors but it still happens. hope some one can help as I only have 2 weeks left to finish this !! here is the sample of code I am using -
import maya.cmds as cmds

for geo in cmds.ls(sl=True):
    pos = cmds.xform(geo, q=True, t=True, ws=True)
    cmds.select(clear=True)
    cmds.joint(p=pos)

Also advice Ive had before was to use the average of verts for the object, but basically I want to create a joint at the pivot point so the bone would be in the correct place for things like car bonnet and boot. average verts would work for wheels but not the door type objects I will also need to rig.

Thanks for any help :)

John.

Replies

Sign In or Register to comment.