ãUnityã2D Animation IKã使ã£ãã¢ãã¡ã¼ã·ã§ã³ã¨IK Solverã®ç´¹ä»
Unity 2021.1.0f1 Personal(2021å¹´4æ)
前回ã®ç¶ãã§ãï¼
ä»åã¯Unityã®2D Animationã«IKãã¤ãã¦ããã¾ãã
IKã¨ã¯Inverse Kinematics ï¼ééåå¦ï¼ã§ãForward Kinematics(FK, é éåå¦)ã®éã®èãã§ãã
FKãä½å¹¹ããé£ãªã£ããã¼ã³ã®ä½ç½®ã»è§åº¦ãã²ã¨ã¤ãã¤é ã«æ±ºå®ãã¦ããã®ã«å¯¾ããIKã¯æ«ç«¯é¨åï¼æå
ã足å
ï¼ãåããæã«ä»ã®é¢ç¯ï¼èã»è©ãªã©ï¼ã®ä½ç½®ã»è§åº¦ãé£åãã¦æ±ºãããã¾ãã
IKã使ãã¨ããã¨ãã°å°é¢ãå¤å½¢ããæããã«åããã¦è¶³é¢ç¯ãåããé©åã«å°é¢ã¨æ¥ããããã«èª¿æ´ãã¦ããããªã©ç¶æ³ã«åãããèªç¶ãªã¢ãã¡ã¼ã·ã§ã³ãå®ç¾ã§ãã¾ãã
IKãæ±ãä¸ã§è¦ãã¦ããã¹ãç¨èª
IKã使ãåã«è¦ãã¦ããã¹ãåºæ¬ç¨èªããç´¹ä»ãã¾ãã
Chainï¼
äºãã«è¦ªåé¢ä¿ã«ãããäºãã«å½±é¿ãåãåããã¼ã³ã®éã¾ãï¼è
ãèãªã©ã®å¡ï¼
Effectorï¼
IKã®æå
端ã«ãããã¼ã³ãEffectorã®åããChainå
¨ä½ã«å½±é¿ãä¸ããã
Targetï¼
Effectorãç®æãç®æ¨å°ç¹ã
Solverï¼
EffectorãTargetã«å°éãããã¯æ大éè¿ä»ãããã®ã¢ã«ã´ãªãºã ã
Unityã¯æ¨æºã§CCD, FABRIK, Limbãç¨æãã¦ããã
Effector(Chainã®å
端)ã¯Targetã«å°éãããã¨ãã¦åã
IK Manager 2Dã使ã
ããã§ã¯å®éã«IKãå®è£
ãã¦ããã¾ãã
前回ä½æãã2Dã¢ãã¡ã¼ã·ã§ã³ã¢ãã«ã«IK Manager 2Dã³ã³ãã¼ãã³ããåãä»ãã¾ãã
IKManager2D
IKSolversã®+ãã¿ã³ãæ¼ãã½ã«ãã¼ãä½æãã¾ãã
ä»åã¯ä¸çªã·ã³ãã«ãªLimbãé¸æãã¾ãã
New LimbSolver2Dã¨ããååã®ã½ã«ãã¼ãçæããã¾ãã®ã§ãEffectorã«ãã¼ã³ããTargetã«ã½ã«ãã¼èªèº«ãæå®ãã¾ãã
Effectorã¨Targetãæå®
ãã®æç¹ã§Sceneãã¥ã¼ä¸ã§ã½ã«ãã¼ãåããã¨IKãä½é¨ã§ãã¾ãã
å·¦æã®è§åº¦ãåºå®ããã¦ãã¦ããããã®ã§ãã½ã«ãã¼ã®Constrain Rotationãfalseã«ãã¦ãªãããã§è§åº¦ãå¤ããããã«ãã¾ãã
Constrain Rotationãfalseã«
IKã«åããã¦æé¦ã®è§åº¦ãå¤ããã¾ãã
åãè¦é ã§å³æã»ä¸¡è¶³ãLimbãä½æãã¾ãã
æå³ããªãæ¹åã«é¢ç¯ãæ²ãã£ãæã¯Flipãå¤æ´ãã¾ãã
å¤ãªæ¹åã«æ²ãã£ã
Flipãå¤æ´ããã¨
æ£ããæ²ããããã«ãªãã¾ã
前回Animatorãã¥ã¼ã§ã¢ãã¡ã¼ã·ã§ã³ãã¤ãã¾ããã
åæ§ã«ã¬ã³ã¼ããã¿ã³ãæ¼ãã¦ããé©åº¦ã«ãã¬ã¼ã ééã空ãã¦IKãåããã°IKã¢ãã¡ã¼ã·ã§ã³ãä½ããã¨ãã§ãã¾ãã
Animatorãã¥ã¼ã§Limbã®åããã¬ã³ã¼ã
IKãå©ç¨ããã¢ãã¡ã¼ã·ã§ã³å®ç¾
IKã½ã«ãã¼ã®ç´¹ä»
ä»åã¯æãã·ã³ãã«ãªLimbã§ã®å®è£
ãç´¹ä»ãã¾ããã
Unityã§ã¯3種é¡ã®ã½ã«ãã¼ãç¨æããã¦ããã®ã§ãç´¹ä»ãã¾ãã
Chain(CCD)
Cyclic Coordinate Descent Inverse Kinematicsã循ç°åº§æ¨éä¸
1ãã¬ã¼ã ã«ä½åãåãã¼ã³ãåããã¦ç®æ¨åº§æ¨ãç®æã軽éã®IKã¢ã«ã´ãªãºã ã
Chain Lengthï¼
å½±é¿ããé¢ç¯æ°ãã§æå®
Iterations(å復)ï¼
ã¢ã«ã´ãªãºã ãé©ç¨ããå復åæ°ã
å°ãªãããã¨ä¸æ£ç¢ºãªä½ç½®ã«ãå¤ãããã¨çµæãåºãå¾ãç¡é§ãªå¦çãç¹°ãè¿ãã¾ãã
IKãå®éã«ã²ã¼ã ã§ä½¿ãå ´åã¯ããå°ããæ°å¤ã«ãã¢ãã¡ã¼ã·ã§ã³ã®ä½ç½®ãç¥ãããã ãã«ä½¿ãå ´åã¯å¤§ããæ°å¤ã«ãã¾ãã
Tolerance(èä¹
)ï¼
IK Solverãå®äºããã¨ã¿ãªãè·é¢ã
transform.positionã®å¤(unit)ãæ±ãã
Velocityï¼
ã¢ã«ã´ãªãºã 1å¾å¾©ãã¨ã«å ç®ã§ããå転ã®å¤§ããã
Weightï¼
IK Solverãã¢ãã¡ã¼ã·ã§ã³ã«å½±é¿ãã強度ã
強度ã¯IK Manager 2Dã³ã³ãã¼ãã³ãã®ã°ãã¼ãã«ãªWeightã¨æãåããã¦æ±ºã¾ãã
Constrain Rotation(å¼·å¶ããè§åº¦)ï¼
trueã«ããã¨Effectorã«æå®ããããã¼ã³ã®è§åº¦ãåºå®ãããã
falseã«ããã¨Effectorã®ãã¼ã³ã¯IKã®ãªãããå¤åãããã¾ãrotation.zãå¤æ´ãã¦ç´æ¥è§åº¦ãå¤ãããã¨ãã§ããã
Solve from Default Poseï¼
trueã«ããã¨ãIKãå®è¡ãããç´åã«ãåTransformãããã©ã«ãã®ä½ç½®ã«ãªã¹ãã¢ãããã
Limbï¼ãªã ãæ足ï¼
CCDã®é¢ç¯ã2ã¤(Transformã3ã¤)ã«éå®ããIKã½ã«ãã¼ã§ãCCDããç°¡æã«æ±ãã¾ãã
Flipï¼
é¢ç¯ã®æ²ããåããå転
Chain(FABRIK)
Forward And Backward Reaching Inverse Kinematicsãåæ¹å¾æ¹å°éã¤ã³ãã¼ã¹ããããã£ã¯ã¹
æ ¹å
ã¨å
端ã交äºã«åºæºã¨ãã¦ç¹°ãè¿ããªããé¢ç¯è§åº¦ã調æ´ãã¦ããIKã¢ã«ã´ãªãºã ã
FABRIK ã¯ä¸è¬çã«ãCCD ãããå°ãªãå復åæ°ã§ã¿ã¼ã²ããã«å°éãããã¨ãã§ãã¾ããããã§ã¼ã³ã«å転ã®å¶ç´ãããããã¦ããå ´åã¯ã1 åã®å復å¦çã CCD ãããé ããªãã¾ãã
Getting Started with 2D Inverse Kinematics2D インバースキネマティクススターティングガイド - Unity Technologies Blog
FABRIKã®ãªãã·ã§ã³ã¯CCDããVelocityãæãããã®ã§ãã
ä»åã¯ä»¥ä¸ã¨ãªãã¾ãã
ãããã¨ããããã¾ããããï¼つづきï¼