Rotate to aim


#1

I googled and searched for this theme, but could not yet find the working solution that would fit my needs.

I am looking for a python or even mel function to simulate AimConstraint behaviour, not in realtime, just to rotate an object to look at another once.

I made a tool, and as part of it’s process it goes through the timeline and selection of objects, aims and transforms objects along curve, and sets keyframes on those.

Due to the specifics of it, I need to only touch the objects with cmds.xform command, I can’t actually constraint them or do anything that could break the rig.

So what I do now, is create temporary locators, aimConstrain those locators, delete contstraint, xform my objects to those locators, etc etc.

It works, but it leaves a lot of garbage in the scene, likr AimBlend nodes, which I then cleanup. And this makes Undo process really slow. So… I hope for your help.

Thanks.


#2

Hi Nixellion

Without a sample scene or further info of your custom rigging, it’s really hard to help you.

I’d love to know why you’ve chosen a custom way to go about your rigs since ( albeit their flaws ) maya’s basic constrainer’s aren’t that bad and even when they are, they do leave many options ( getting away with gimbal locks and such ) for the TD / rigger to fiddle with.

So, without a sample scene and your code, it’s fair to say that I’m out of means to help you.

Someone else might not, though.

/risto


#3

Thanks for your attention!
Well, it’s not about rigging really, I was working on a universal script to quickly add nHair sim to any chain of selected objects, to speed up some animation routine without the need to include dynamics into the rig. I’m currently freelancing and often have to work with rigs which someone else made, I don’t want to mess up with those much, so, well, finally I did this thing:

https://www.youtube.com/watch?v=_Qrpx3otvzU
It could probably look silly, but it comes in really handy

I did not want to add any constraints for controls shapes, so instead I just created temporary locators and aimConstrained them, and used them to xform controls to. But it was a slow process, and the Undo was really slow, like 5-10 seconds.

But I found a workaround without vector math. Instead of creating and deleting locators and constraints (which also made insane amount of blendAim nodes) for each operation, I just create 2 locators at the start of the simulation, and reuse them. Works really fast now, as you can see from the video, and undo work almost instantly, allowing for quick iteration.

I know, I could’ve probably created locators along the curve for the duration of the simulation, but this way seemed actually simpler to me, just grabbing cvs’ positions and operating with them, and with less nodes created in the process.