constrain pos to a spherical radius

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  11 November 2013
constrain pos to a spherical radius

trying to solve a rigging problem
I want to control the orientation of a bone using a lookat constraint,
while limiting the pos of the lookat target to the bone's length (the bone cannot stretch)
sort of a constrain to radius of Bone.length

I can't seem to do this with simple constraints.
I think it could be done with paramwire or a pos script
but I'm not sure what the script would look like.
Attached Images
File Type: jpg how.jpg (77.2 KB, 2 views)

Last edited by Mambo4 : 11 November 2013 at 09:45 PM.
  11 November 2013
it's the default behavior for bones. just be sure that both boneEnable and boneFreezeLength properties are set to ON
  11 November 2013
That was my first approach, but CTRL is for animators, so it needs to be work reliably with auto-key.
Bone Ends do not auto-key : they auto-key their parent bone's controllers instead.

You can set a key on a bone end with the set key button,
but this is not what the animators want.

is there some way to let bone ends autokey?

Last edited by Mambo4 : 11 November 2013 at 10:39 PM.
  11 November 2013
Originally Posted by Mambo4: That was my first approach, but CTRL is for animators, so it needs to be work reliably with auto-key.
Bone Ends do not auto-key : they auto-key their parent bone's controllers instead.

You can set a key on a bone end with the set key button,
but this is not what the animators want.

is there some way to let bone ends autokey?

move the end but get a key on its bone. is that you want?
  11 November 2013
Key frames on bones are not what is needed.
We store our animation data on as control object key frame data, not bone key frame data.
I need the process to produce keyframe data on CTRL.pos.
  11 November 2013
What would happen if the CTRL object isn't constrained to the radius of the bone's length? Would that result in squashing/stretching of the bone in the engine?

Could you try path constraining a dummy to a circle whose radius == bone's length. Look-at constrain the bone to the dummy then wire a CTRL object's Z_pos to the dummy's path percentage and the CTRL's Y_pos to the circle's Z_rot? Or would that not work because the keys are on a "joystick" type CTRL object?
  11 November 2013
constraining the CTRL like a bone nub was a specific request of the animators.
This is for a facial bone control rig, and they want the CTRL objects to more or less adhere to the face. Free floating CTRL objects have less predictable results : the farther form the mesh they go the less predictable the bone's rotation - and thus mesh deformation - will be.

an example of the style of face bones (not mine)

The CTRL objects need to move in all dimensions,but stick to the bone radius. I don;t think a circle path would give the animators what they want.

As it is, the Bone enabled set up works 90%.
that last 10% is the auto-key ignoring CTRL.pos and setting bone.rot keys instead.
The animators could set key deliberately, but they don't want to by force of habit.
Maybe I need to script something that forces set key on any child of those bones...

Last edited by Mambo4 : 11 November 2013 at 12:02 AM.
  11 November 2013
wow... can't say anything else. do you really want to implement this UI approach? today... it's might be a fun but too 'vintage' ...IMHO
  11 November 2013
I may have found something

when transform $CTRL change handleAt:#redrawViews  do (
	if (animButtonState) then(
		addNewKey $CTRL.controller[#Position][#Zero_Pos_XYZ] currentTime

So it looks like I can cause the desired behaiviour via change handlers...but these are not saved with the scene. Can I Put change handlers into a scripted custom attribute?
  11 November 2013
It may be a bit 'vintage' but we have a very low target platform, so exportable bones and such are limited. Given the need for the CTRL key data to be separate and the bones to not stretch,
what would you recommend? I don;t think I have the bandwidth for a full on OSIPA style face rig...
  11 November 2013
you can save "when" change handlers in the scene by assigning it to a persistent global variable. But this will fire and put a key on every frame. Look at one of my threads where I'm asking questions about "when" handlers, where Denis explained they're not good for animation.

Just link your control object to your main bone (not the nub) and turn on its bone property then your dummy or point helper will move like you want (in essence it acts like a nub bone now); to avoid keying the parent bone... try this:

on your CTRL object disinherit rotations from parent bone. Then wire your CTRL object rotations to your parent bone rotations and make it a two-way connection. Then set your coordsys to parent and animate your control object's rotations... then have a callback or something to go back and put a position key at each frame where you have a rotation key on your control object.

seems to work for me in a quick and dirty test. Not sure what the drawbacks might be. Anybody see any pitfalls with this idea?

Last edited by Archangel35757 : 11 November 2013 at 02:37 AM.
  11 November 2013
It seems to work really well. I don't know how it'll work for the OP but I learned something from it. Thanks!
  11 November 2013
I messed around with the change script and came up with this method of constraining the ctrl postion as if it were the bone nub, without setting it to boneEnbaled true

when transform $ctrl changes do( in coordsys parent($ctrl.pos=(normalize $ctrl.pos * $bone.length))) 

(this case, $ctrl.parent shares the pos of $bone)

To keep the constraint across sessions, I built a button function to apply the code to each CTRL / Bone pair, and added it via custom attributes to the root control. The animator enables the change script when they wish.

I thought a script controller could do this, but a position script seems to disable the move manipulator.

I'll hunt down the thread mentioned and see the folly of my approach
  11 November 2013
Try to render your animation. Does it render properly?
  11 November 2013
rendering is irrelevant.
we are exporting to a game engine, all bone transforms get baked in FBX.
CTRL keyframes are saved in XAF files for re-use.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:42 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.