Notifications
Clear all

[Closed] Can impossible be possible? (The real challenge)

Well, thanks to MikieK, his post helps me to do workable structure below. But I still can’t replace .isSelected to right thing, independent on selection. It works if you select boxes.

b1=box pos: [0,0,0] length: 10 width: 10 height: 10
b1.pivot=b1.center

b2=box pos: [0,0,100] length: 10 width: 10 height: 10
b2.pivot=b2.center
in coordsys local rotate b2 (eulerAngles 180 0 0)

p=point pos: [0,0,50]
ps=position_script()
ps.addNode "b1" b1
ps.addNode "b2" b2
ps.setExpression "(b1.pos+b2.pos)*.5"

p.pos.controller=ps

lc=lookAt_constraint viewline_length_abs: off

p.rotation.controller=rotation_list()
lc.appendTarget b1 100
lc.appendTarget b2 100

lc.target_axis = 2
lc.upnode_axis = 1
lc.StoUP_axis = 1

p.rotation.controller.Available.controller=lc

rc=rotation_script()
rc.addNode "b1" b1
rc.addNode "b2" b2

txt="if b1.isSelected then (
" +
"m=b1.transform
" +
"m.row4=[0,0,0]
" +
"translate m (b1.pos-[0,0,100]*(inverse b1.rotation))
" +
"b2.transform=m
" +
")
" +
"else if b2.isSelected then (
" +
"m=b2.transform
" +
"m.row4=[0,0,0]
" +
"translate m (b2.pos+[0,0,100]*(inverse b2.rotation))
" +
"b1.transform=m
" +
")
" +
"quat 0 0 0 1"

rc.setExpression txt
p.rotation.controller.Available.controller=rc

there are couple problems:

using of “isselected” kills the ‘controller’ solution. for example this rig will not work for net render

the rig is not animatable

but it’s very good illustration what i asked for.
the nodes have not to look at each other. it’s not really a necessary condition but it might be an option.

Second try. It works, but becomes very unstable during animation. 2010 max crashes some times and i have no idea how to fix that.

b1=box pos: [0,0,0] length: 10 width: 10 height: 10
 b1.pivot=b1.center
 
 b2=box pos: [0,0,100] length: 10 width: 10 height: 10
 b2.pivot=b2.center
 in coordsys local rotate b2 (eulerAngles 180 0 0)
 
 p1=point pos: [0,0,50] size: 10 cross: off box: on wireColor: (color 255 0 0)
 ps1=position_script()
 --ps1.addObject "a1" b1.rotation.controller
 ps1.addNode "b1" b1 --(NodeTransformMonitor node: b1 forwardTransformChangeMsgs: false)
 ps1.addObject "b2" (NodeTransformMonitor node: b2 forwardTransformChangeMsgs: false)
 
 txt1="m=b1.transform
"+
 "m.row4=[0,0,0]
"+
 "translate m (b1.pos-[0,0,100]*(inverse b1.rotation))
"+
 "b2.transform=m
"+
 "(b1.pos+b2.pos)*.5"
 ps1.setExpression txt1
 
 p2=point pos: [0,0,50] size: 20 cross: off box: on wireColor: (color 255 255 0)
 ps2=position_script()
 --ps2.addObject "a2" b2.rotation.controller
 ps2.addNode "b0" b2 --(NodeTransformMonitor node: b2 forwardTransformChangeMsgs: false)
 ps2.addObject "b1" (NodeTransformMonitor node: b1 forwardTransformChangeMsgs: false)
 p2.parent=p1
 
 txt2="m=b0.transform
"+
 "m.row4=[0,0,0]
"+
 "translate m (b0.pos+[0,0,100]*(inverse b0.rotation))
"+
 "b1.transform=m
"+
 "[0,0,0]"
 ps2.setExpression txt2
 
 p1.pos.controller=ps1
 p2.pos.controller=ps2
 

Using script controllers couldn’t you do this…

A = end point object
B = center point object
C = end point object

Wouldn’t it be possible to have object A’s position/rotation mirror (be the opposite of that of object C’s but in relation to the transform of point B. Point B would be position and orientation constrained between the two end points.

It would most likely require ‘listed controllers’

Because it’s possible to mirror positions by negative weighting controllers. Hopefully this makes sense.

Not to much time at the moment in the morning but just quickly putting a position list with a reference of the other node and then typing in the script controller

“-ref.position’ The only downside is that it only works on the one node. Need to figure out how to week reference the other node. I’ve got some ideas though. Keep on the look out.

If anyone wants to know more about this you can try to find Charles blog post on this topic from February of this year.

-Eric

i want to know more about this. but i don’t know what ‘this’ is and how find it
do you mean the rig solution or mirror transforms?

Has anyone been able to find this post anywhere?

1 Reply
 eek
(@eek)
Joined: 10 months ago

Posts: 0

Thanks for the link, – the post was actually in response to what Maulik was trying to do – namely multi-directional constraints.

I basically first started with a single one directional system – single object, multiple targets. This is pretty simple – if i have object A and object B, you store A’s transform relative to B. Then A assumes B’s transform space relative to A’s coordinate space. (remember if A has a parent you getting it relative to its parent) Then adding the stored transform back. Its really very simple.

What I found tricky was having A follow B and vice versa i.e multi-directional-ness – so basically I use the forward transform monitor to push transform updates but not have a direct reference. What is hard making it friendly for the user.

What i can tell you is mixing up both methods, i.e having one child, lots of parents (single direction), and lots of children one parent (multi-direction) causes lots of pain, in terms of evaluation order – don’t try it.

Denis,

Im not sure i follow you in saying the weak reference is a myth, do you mean functionality or the fact that node assignment in script controllers use it automatically – therefore you don’t have to strictly define it. I like the fact i can push transform changes to an object without needing a direct link to it. Or do you mean for this problem?

As to the problem in question, you could do something like this:

Two objects: A, B

Instance the rotation controller between the two
Give both a position list controller, with two bezier_position controllers in each.
Instance the first position controller between the two.
On the second create a script controller with something like this:

*Rot is the instance rotation controller between the two
For A – (transMatrix [0,0,100] * rot.value).pos
For B – (transMatrix [0,0,-100] * rot.value).pos

Your going to have to handle the the switch, by keying the second controllers weight and shift the switched weights object position back. Basically your keying the offset. But all doable.

Page 3 / 5