X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
Revisão | 352 (tree) |
---|---|
Hora | 2023-02-18 19:56:06 |
Autor | xops-mikan |
AI移動時のジャンプ処理を改善
@@ -504,16 +504,35 @@ | ||
504 | 504 | bool AIcontrol::MoveJump() |
505 | 505 | { |
506 | 506 | //立ち止まっていれば処理しない |
507 | + // ※AIObjectDriver(ObjDriver)の移動フラグでチェックしても良い。 | |
507 | 508 | if( ctrlhuman->GetMovemode(false) == 0 ){ return false; } |
508 | 509 | |
509 | 510 | float dist_dummy; |
510 | 511 | |
512 | + float check_rx = 0.0f; | |
511 | 513 | float new_posx, new_posy, new_posz; |
512 | 514 | |
515 | + //進行方向を算出 | |
516 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVEWALK) == true ){ | |
517 | + check_rx = DegreeToRadian(0.0f); | |
518 | + } | |
519 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVEFORWARD) == true ){ | |
520 | + check_rx = DegreeToRadian(0.0f); | |
521 | + } | |
522 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVEBACKWARD) == true ){ | |
523 | + check_rx = DegreeToRadian(180.0f); | |
524 | + } | |
525 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVELEFT) == true ){ | |
526 | + check_rx = DegreeToRadian(90.0f); | |
527 | + } | |
528 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVERIGHT) == true ){ | |
529 | + check_rx = DegreeToRadian(-90.0f); | |
530 | + } | |
531 | + | |
513 | 532 | //腰付近の当たり判定 |
514 | - new_posx = posx + cosf(rx*-1 + (float)M_PI/2) * (AI_CHECKJUMP_DIST + HUMAN_MAPCOLLISION_R); | |
533 | + new_posx = posx + cosf(rx*-1 + (float)M_PI/2 + check_rx) * (AI_CHECKJUMP_DIST + HUMAN_MAPCOLLISION_R); | |
515 | 534 | new_posy = posy + HUMAN_MAPCOLLISION_HEIGHT; |
516 | - new_posz = posz + sinf(rx*-1 + (float)M_PI/2) * (AI_CHECKJUMP_DIST + HUMAN_MAPCOLLISION_R); | |
535 | + new_posz = posz + sinf(rx*-1 + (float)M_PI/2 + check_rx) * (AI_CHECKJUMP_DIST + HUMAN_MAPCOLLISION_R); | |
517 | 536 | if( CollD->CheckALLBlockInside(new_posx, new_posy, new_posz) == true ){ |
518 | 537 | ObjMgr->MoveJump(ctrlid); |
519 | 538 | return true; |
@@ -520,9 +539,9 @@ | ||
520 | 539 | } |
521 | 540 | |
522 | 541 | //体全体の当たり判定 |
523 | - new_posx = posx + cosf(rx*-1 + (float)M_PI/2) * AI_CHECKJUMP_DIST; | |
542 | + new_posx = posx + cosf(rx*-1 + (float)M_PI/2 + check_rx) * AI_CHECKJUMP_DIST; | |
524 | 543 | new_posy = posy + AI_CHECKJUMP_HEIGHT; |
525 | - new_posz = posz + sinf(rx*-1 + (float)M_PI/2) * AI_CHECKJUMP_DIST; | |
544 | + new_posz = posz + sinf(rx*-1 + (float)M_PI/2 + check_rx) * AI_CHECKJUMP_DIST; | |
526 | 545 | if( CollD->CheckALLBlockInside(new_posx, new_posy, new_posz) == true ){ |
527 | 546 | ObjMgr->MoveJump(ctrlid); |
528 | 547 | return true; |