- 3ds Max初心者質問スレ Part14
669 :666[sage]:2014/08/27(水) 19:25:29.64 ID:0lV/gFJe - 制限超えたんで分割
繋げて実行するとノードが三つ作成されます オレンジ色のヘルパーを回転させてコントロールします ( local controlNode = Point centerMarker:false axisTripod:true cross:false box:true size:60.0 wireColor:orange name:"Control" local lastPivotNode = Point centerMarker:false axisTripod:true cross:false box:true size:5.0 wireColor:yellow name:"LastPivot" local boxNode = Box length:20.0 width:20.0 height:20.0 lengthSegs:1 widthSegs:1 heightSegs:1 wireColor:blue name:"Box" local nodes = #( controlNode, lastPivotNode, boxNode ) for n in nodes do (n[ 3 ][ 1 ].controller = Position_XYZ();n[ 3 ][ 2 ].controller = TCB_Rotation()) boxNode[ 3 ][ 1 ].controller = Position_Script() boxNode[ 3 ][ 1 ].controller.addNode "lastPivot" lastPivotNode boxNode[ 3 ][ 1 ].controller.addObject "rot" controlNode[ 3 ][ 2 ].controller
| - 3ds Max初心者質問スレ Part14
670 :666[sage]:2014/08/27(水) 19:26:22.58 ID:0lV/gFJe - local ss = StringStream ""
format "local corners = #( [-10,-10,0], [10,-10,0], [-10,10,0], [10,10,0], [-10,-10,20], [10,-10,20], [-10,10,20], [10,10,20] )\n" to:ss format "local lastPivotTM = lastPivot.objectTransform\n" to:ss format "local currentRotTM = ( normalize rot.value ) as Matrix3\n" to:ss format "local newPivotTM = Matrix3 currentRotTM.row1 currentRotTM.row2 currentRotTM.row3 lastPivotTM.row4\n" to:ss format "local newCornerTM = undefined\n" to:ss format "for i = 1 to corners.count do\n(\n" to:ss format "\tlocal cornerWTM = ( Matrix3 [ 1, 0, 0 ] [ 0, 1, 0 ] [ 0, 0, 1 ] corners[ i ] ) * newPivotTM\n" to:ss format "\tif newCornerTM == undefined or cornerWTM.row4.z < newCornerTM.row4.z do newCornerTM = cornerWTM\n)\n" to:ss format "local lastCornerTM = ( Matrix3 [ 1, 0, 0 ] [ 0, 1, 0 ] [ 0, 0, 1 ] ( newCornerTM * inverse newPivotTM ).row4 ) * lastPivotTM\n" to:ss format "lastCornerTM.row4.z = 0\nnewPivotTM.row4 += lastCornerTM.row4 - newCornerTM.row4\n" to:ss format "with animate off lastPivot[ 3 ].value = newPivotTM\nnewPivotTM.row4" to:ss boxNode[ 3 ][ 1 ].controller.setExpression ( ss as String ) boxNode[ 3 ][ 2 ].controller = Rotation_Script() boxNode[ 3 ][ 2 ].controller.addObject "master" controlNode[ 3 ][ 2 ].controller boxNode[ 3 ][ 2 ].controller.setExpression "master.value" ) 正直俺にはこの辺が限界・・・ ボックスの回転だけで実現したかったけど評価順序の関係で難しいね 現状は初期状態みたいなものも無いから実用にはあと一歩改良が必要かな
|
|