Created
September 23, 2018 21:04
-
-
Save serguei-k/76b2024ba449745bd209dade5c41f4c3 to your computer and use it in GitHub Desktop.
Project Vector to Plane v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get plane normal | |
axis = cmds.createNode('math_AxisFromMatrix', name='proj_AXI') | |
cmds.connectAttr('plane.matrix', axis + '.input') | |
cmds.setAttr(axis + '.axis', 1) | |
# get dot product between vector and normal | |
dot = cmds.createNode('math_DotProduct', name='proj_DOT') | |
cmds.connectAttr('src.translate', dot + '.input1') | |
cmds.connectAttr(axis + '.output', dot + '.input2') | |
# scale normal | |
scale = cmds.createNode('math_MultiplyVector', name='proj_MUL') | |
cmds.connectAttr(axis + '.output', scale + '.input1') | |
cmds.connectAttr(dot + '.output', scale + '.input2') | |
# subtract result from vector | |
proj = cmds.createNode('math_SubtractVector', name='proj_SUB') | |
cmds.connectAttr('src.translate', proj + '.input1') | |
cmds.connectAttr(scale + '.output', proj + '.input2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment