ãã¼ã ï¼ã²ã¼ã ã¤ããã¼ï¼ï¼è¡çªå¤å®ç·¨ï¼ OBBã¨OBBã®è¡çª 3Dè¡çªç·¨ ãã®13 OBBã¨OBBã®è¡çª è¡çªã®æ¬ä¸¸ã®1ã¤ãOBBã¨OBBãã®è¡çªã§ãã大ããã®éããäºãã«3次å çã«å転ããç´æ¹ä½ãè¡çªãã¦ãããã©ããã調ã¹ãã¨ããã®ã¯ãã¯ãç°¡åã§ã¯ããã¾ãããããããã§ããã¨å¤ç¨®å¤æ§ãªæ¹é¢ã§å½¹ã«ç«ã¡ã¾ããOBBå士ã®è¡çªã¨ãã¦ä¸»æµãªã®ã¯ãåé¢è»¸å¤å®ãã¨å¼ã°ããæ¹æ³ã§ãã¦ãããã§ãããã«ã¤ãã¦è¦ã¦ããã¾ããã¡ãã£ã¨æ·±å¼å¸ãã¦ã覧ä¸ãã(^-^; â ãåé¢è»¸ãå¤å®ã¨ã¯ï¼ OBBã®è¡çªã«ã¯ãåé¢è»¸ãã¨ããç©ãç»å ´ãã¾ããããããã£ããä½ãªã®ãï¼ã¾ãã¯ä¸ã®å³ãã覧ä¸ããã ä¸ã®OBBã¯æããã«è¡çªãã¦ãã¾ããããã®æã両æ¹ã®OBBãåããç´ç·ãã絶対ã«ãåå¨ãã¾ãããã®ç´ç·ã¯ãã¡ãã£ã¨å°é£ããè¨èã§è¨ãã¨åé¢è¶ å¹³é¢ï¼Separating hyperplaneï¼ã¨å¼ã°ãã¦ãã¾ããç´ç·ãªã®ã«å¹³é¢ã¨
ãä¹ ãã¶ãã§ããè¦ãã¦ãæ¹ãããããã§ããããã ã¿ã¤ãã«ã®éããPhysics.CapsuleCast()ã«ã¤ãã¦ã®è³ªåãªã®ã§ããã Unityã®ãªãã¡ã¬ã³ã¹(è±èª)ã§ã¯ããã®é¢æ°ã¯ ã³ã¼ã: static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float distance = Mathf.Infinity, int layerMask = DefaultRaycastLayers); ã¨ãªã£ã¦ãã¾ãã point1ããpoint2ã¾ã§ãåå¾radiusã®å¤§ããã®ã«ãã»ã«ãé ç½®ããã ã¨ããã®ã¯ãããã®ã§ãããdirectionã¨distanceã®æå³ããã¾ãã¡ç解ã§ãã¾ããã ãªãã¡ã¬ã³ã¹ã§ã¯ãdirectionã®æ¹åã«distanceã®é·ãã ãã«ãã»ã«ãã¹ã¤ã¼
ãã¼ã < ã²ã¼ã ã¤ããã¼ï¼ < DirectXæè¡ç·¨ ãã®48 ã¹ã¯ãªã¼ã³åº§æ¨ã§ã¯ã¼ã«ã空éã®å°é¢ãæã ãã¦ã¹ã«ã¼ã½ã«ãç¨ãã3Dã®RPGãªã©ã§ã¯ãã«ã¼ã½ã«ã§å½ããåã®ããã«å®ç®±ãæããã¨ãã§ãã¾ããã§ãè¯ãèãã¦ã¿ãã¨ä¸æè°ã§ãããã¦ã¹ã«ã¼ã½ã«ã®åº§æ¨ã¯2次å ã®ã¹ã¯ãªã¼ã³åº§æ¨ï¼ã¯ã©ã¤ã¢ã³ã座æ¨ï¼ã§ããããã«å¯¾ãã¦å®ç®±ã¯3次å ã®ã¯ã¼ã«ã空é座æ¨ã«ããã¾ãã座æ¨ç³»ãããããéãã®ã«é è¿æãèæ ®ãã¦æ£ããæãäºãã§ãããè£ã§ã¯ãã£ããä½ããã¦ããã®ã§ããããï¼ç§å¯ã¯ã¹ã¯ãªã¼ã³åº§æ¨ããã¯ã¼ã«ã座æ¨ãæ±ããã¨è¨ããé常ã¨ã¯éæ¹åã®å¤æã«ããã¾ãã ãã®ç« ã§ã¯ãã¹ã¯ãªã¼ã³åº§æ¨ãã¯ã¼ã«ã座æ¨ã«å¤æããæ¹æ³ã«ã¤ãã¦è¦ã¦ãããã¹ã¯ãªã¼ã³ã«æ ã£ã¦ããåºãã¯ã¼ã«ã座æ¨ã¬ãã«ã§æã示ãæ¹æ³ã«ã¤ãã¦æ¤è¨ãã¦ã¿ã¾ãããã â 決ãæã¯ãéè¡åã ã¯ã¼ã«ã座æ¨ã«ç¹Pããã£ãã¨ãã¾ãããã®ç¹ãä½ããã®è¡åMã«ãã£ã¦ç§»
ãé¡ã¯ãxyå¹³é¢ã®ä¸è§å½¢ã«ã¤ãã¦èãããããã¨ãxyå¹³é¢ä¸ã®ãã¯ãã«ã®å¤ç©ã¯ãè§åº¦ãå¿ ãxyå¹³é¢ã¨åç´ã¤ã¾ãz軸ã¨å¹³è¡ã«ãªããã¤ãã«ãã®æ¹åã¯ããµãã¤ã®ãã¯ãã«ãæè¨åãã®ä½ç½®ã«ããã°ãå³ãã¸ã®åãã§ããz軸ã®æ£æ¹åã ãéã«ãxyå¹³é¢ä¸ã®ãµãã¤ã®ãã¯ãã«Aã¨Bã®å¤ç©AÃBãz軸æ£æ¹åã ã£ãã¨ããã¨ããã¯ãã«Aã®å³å´ã«Bãããã ããã§ãä¸è§å½¢ã®3辺ãæè¨åãã®åãã®ãã¯ãã«ã¨èãããã調ã¹ã座æ¨ãä¸è§å½¢ã®å å´ã«ããå ´åã1辺ã®ãã¯ãã«ã¨ãã®å§ç¹ãããã®åº§æ¨ã¸ã®ãã¯ãã«ã¨ã®å¤ç©ãæ±ããï¼å³2â ï¼â ã3辺ã®ãã¯ãã«ãã¹ã¦ã«ã¤ãã¦ã調ã¹ã座æ¨ã®ãã¯ãã«ãå³å´ã«ããã°ãããªãã¡ãã®åº§æ¨ã¯ä¸è§å½¢ã®å å´ã«ãªãã å³2ãå¤ç©ã§2次å å¹³é¢ä¸ã®åº§æ¨ãä¸è§å½¢ã®å å´ã«ãããã©ããã調ã¹ã ã§ã¯æ©éããµãã¤ã®ãã¯ãã«ãä¸ãã¦ãå³ãã¸ã®ä½ç½®ã«ãããã©ãã調ã¹ãé¢æ°ï¼xIsRight()ï¼ãå®ãããããã¯ãã«ã¯xyå¹³
解説 æ¬æ¥å½ããå¤å®ã¯æ ¼éã²ã¼ã ã¨ãã«ãå¿ç¨ã§ãã¦å ±éã§æ¸ããã¨ãæãã¾ããã ã§ãããå½ããå¤å®ã¨ãã£ããã·ã¥ã¼ãã£ã³ã°ã²ã¼ã ã¨ãããããã«éè¦æ§ãé«ãã®ã§ããã§æ¸ãããã¨æãã¾ã. ãã®å½ããå¤å®ã¯ã·ã¥ã¼ãã£ã³ã°ã²ã¼ã ã«ããã¦æéè¦ã¨ããã話é¡ã§ãã ä»å説æããå 容ã¯æ¯é±éææ¥ã«ãã C3 ã¼ãã§çºè¡¨ããå 容ã§ãã å°ãä»å説æããå½ããå¤å®ã¯æ°å¦ãçµæ§åºã¦ãã¾ããæ°ãå¼ãç· ãã¾ãããã â äºç¹éè·é¢ãç¨ããæ¹æ³ å¤å誰ããæåã«èãä»ãã®ããã®æ¹æ³ã§ã¯ãªãã§ããããï¼ äºç¹éè·é¢ã¨åã®åå¾ãç¨ãã¦å½ããå¤å®ãå®è£ ãã¾ãã èªåãæåãã®æ¹æ³ã使ãã¾ããã æµã®å¼¾ã®åº§æ¨ã(X1,Y1),å¼¾ã®åå¾ãR1ãèªæ©ã(X0,Y0)ãèªæ©ã®åå¾ãR0ã¨ãã¾ãã åå¾R1ãR0ã®åãè·é¢ã«çããã¨ãã«ã¡ããã©åå士ã触ãåããåãè·é¢ä»¥ä¸ã®ã¨ãã«HITããã¨ãããã¨ã§ãã bool IsHit
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}