[Closed] Up-nodes
I’ve run into a small maxcript problem that I don’t understand. Any advice is appreciated:
local currentBoneUpNode = [0,0,1] --or[1,0,0], or[0,1,0] depending
local freshBone = BoneSys.createBone buildPOS1 buildPOS2 [0,0,1] --buildPOS1&2 = random .pos
case of
(
(currentBoneUpNode == [1,0,0]): freshBone.rotation.controller.upnode_axis = 0 --Xaxis upnode set
(currentBoneUpNode == [0,1,0]): freshBone.rotation.controller.upnode_axis = 1 --Yaxis upnode set
(currentBoneUpNode == [0,0,1]): freshBone.rotation.controller.upnode_axis = 2 --Zaxis upnode set
default: freshbone.rotation.controller.upnode_axis = 2 --defaults to Z axis
)
--ERROR: --Unknown property: "upnode_axis" in Controller:Euler_XYZ
I'm trying to set the upnode_axis property of the rotation controller of the bone by user input, but for some reason it's just not working. I can't find a property for the Euler_XYZ controller named upnode_axis, which the error is pointing out, I think.
But if I try:
$'SBChain1:stretchyB2'.rotation.controller.upnode_axis = 1
Max correctly changes the bone's upnode axis to the Y value.
*There is a strange bug on the CGTalk forum that will not allow me to delete the double spaces after the under score in the above code. It should read ‘.controller.upnode_axis = 1’.
Does the problem lie in how I'm addressing the node? Example: addressing by 'freshBone' rather than by $'SBChain1:stretchyB2'? I've also tried first selecting the 'freshBone', then trying $.rotation.controller.upnode_axis = 1, but it returns the same error.
I'm probably missing something very obvious and simple. Halp! :sad:
your code is working fine with me… are you sure that you have actually assigned a rotation controller to freshbone someplace earlier in your script?
You’re trying to change a non-existant property on the object’s rotation controller. Euler_xyz controllers don’t have a upnode_axis property. You probably just forgot to apply a look-at constraint to it. This code works:
(
local currentBoneUpNode = [0,0,1] --or[1,0,0], or[0,1,0] depending
local freshBone = BoneSys.createBone [0,0,0] [10,0,0] [0,0,1] --buildPOS1&2 = random .pos
lookAtConstraint = freshBone.rotation.controller = lookAt_constraint()
case of
(
(currentBoneUpNode == [1,0,0]): lookAtConstraint.upnode_axis = 0 --Xaxis upnode set
(currentBoneUpNode == [0,1,0]): lookAtConstraint.upnode_axis = 1 --Yaxis upnode set
(currentBoneUpNode == [0,0,1]): lookAtConstraint.upnode_axis = 2 --Zaxis upnode set
default: lookAtConstraint.upnode_axis = 2 --defaults to Z axis
)
)
yeap… i was also testing with a lookAt_constraint… i didn’t realize that you were using an Euler_XYZ controller… but then your second piece of code shouldn’t work too…
You guys are both right! I hadn’t assigned a look-at constraint to it yet. Thanks!