Violet Vreath is Shooter Game for Windows XP+(個人制作シューティングゲーム)
| Revision | 54af9b96447af94038036aa656d937a30395f4d0 (tree) |
|---|---|
| Time | 2023-10-03 21:19:34 |
| Author | |
| Commiter | gecchi |
平均すると先がへにょる、平均しないとぎざぎざになる、困った;;
| @@ -583,10 +583,10 @@ public: | ||
| 583 | 583 | * @param out_nvx |
| 584 | 584 | * @param out_nvy |
| 585 | 585 | */ |
| 586 | - static void getNormalizedVector(double x, | |
| 587 | - double y, | |
| 588 | - double& out_nvx, | |
| 589 | - double& out_nvy) { | |
| 586 | + static void getNormalized2DVector(double x, | |
| 587 | + double y, | |
| 588 | + double& out_nvx, | |
| 589 | + double& out_nvy) { | |
| 590 | 590 | const double t = 1.0 / sqrt(x * x + y * y); |
| 591 | 591 | out_nvx = t * x; |
| 592 | 592 | out_nvy = t * y; |
| @@ -599,10 +599,10 @@ public: | ||
| 599 | 599 | * @param out_nvx |
| 600 | 600 | * @param out_nvy |
| 601 | 601 | */ |
| 602 | - static void getNormalizedVector(coord x, | |
| 603 | - coord y, | |
| 604 | - double& out_nvx, | |
| 605 | - double& out_nvy ) { | |
| 602 | + static void getNormalized2DVector(coord x, | |
| 603 | + coord y, | |
| 604 | + double& out_nvx, | |
| 605 | + double& out_nvy ) { | |
| 606 | 606 | const double vx = (double)(x * (1.0 / (LEN_UNIT * PX_UNIT))); |
| 607 | 607 | const double vy = (double)(y * (1.0 / (LEN_UNIT * PX_UNIT))); |
| 608 | 608 | const double t = 1.0 / sqrt(vx * vx + vy * vy); |
| @@ -94,7 +94,7 @@ void Direction8Util::cnvVec2Sgn(float prm_vx, float prm_vy, | ||
| 94 | 94 | static const double v = 0.9238795325112; |
| 95 | 95 | |
| 96 | 96 | double nvx, nvy; |
| 97 | - UTIL::getNormalizedVector(prm_vx, prm_vy, | |
| 97 | + UTIL::getNormalized2DVector(prm_vx, prm_vy, | |
| 98 | 98 | nvx, nvy); |
| 99 | 99 | |
| 100 | 100 | // |
| @@ -560,7 +560,7 @@ void MyBunshinBase::setBunshinNum(int prm_num) { | ||
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - const angvelo INNER_ROT = D_ANG(0.5); //分身がぐるぐる旋回している速度 | |
| 563 | + const angvelo INNER_ROT = D_ANG(1); //分身がぐるぐる旋回している速度 | |
| 564 | 564 | const angvelo OUTER_ROT = -D_ANG(1); |
| 565 | 565 | const coord INNER_RADIUS = PX_C(50); //内側分身の中心からの距離 |
| 566 | 566 | const coord OUTER_RADIUS = PX_C(120); //外側分身の中心からの距離 |
| @@ -24,7 +24,7 @@ using namespace GgafLib; | ||
| 24 | 24 | using namespace VioletVreath; |
| 25 | 25 | |
| 26 | 26 | const velo MyBunshinWateringLaserChip001::MAX_VELO = PX_C(512); //この値を大きくすると、最高速度が早くなる。 |
| 27 | -const int MyBunshinWateringLaserChip001::R_MAX_ACCE = 20; //MAX_VELO に対する加速度、この値を大きくすると、カーブが緩くなる。小さくすると、カーブがきつくなるがギザギザになりやすい | |
| 27 | +const int MyBunshinWateringLaserChip001::R_MAX_ACCE = 25; //MAX_VELO に対する加速度、この値を大きくすると、カーブが緩くなる。小さくすると、カーブがきつくなるがギザギザになりやすい | |
| 28 | 28 | const velo MyBunshinWateringLaserChip001::INITIAL_VELO = MAX_VELO*0.6; //レーザー発射時の初期速度 |
| 29 | 29 | const acce MyBunshinWateringLaserChip001::MAX_ACCE_RENGE = MAX_VELO/R_MAX_ACCE; |
| 30 | 30 | const velo MyBunshinWateringLaserChip001::MIN_VELO_ = MyBunshinWateringLaserChip001::INITIAL_VELO/2; // ÷2 は、最低移動する各軸のINITIAL_VELOの割合 |
| @@ -363,17 +363,25 @@ throwCriticalException("pLeaderChip_AimInfo_ | ||
| 363 | 363 | //なぜなら dispatch の瞬間に_pChip_behind != nullptr となるが、active()により有効になるのは次フレームだから |
| 364 | 364 | //_x,_y,_z にはまだ変な値が入っている。 |
| 365 | 365 | if (pB && pB->isActive()) { |
| 366 | - if (_dispatch_index == 0) { //N_DISPATCH_AT_ONCE の節目が角張るので平均化を強くした | |
| 367 | - _x = _x + (coord)((pB->_x-_x)*0.4 + (pF->_x-_x)*0.5); | |
| 368 | - _y = _y + (coord)((pB->_y-_y)*0.4 + (pF->_y-_y)*0.5); | |
| 369 | - _z = _z + (coord)((pB->_z-_z)*0.4 + (pF->_z-_z)*0.5); | |
| 370 | - } else { | |
| 371 | - //中間座標に再設定 | |
| 372 | - //座標の重みは、(ひとつ前, 自身, 一つ先)= (0.2, 0.3, 0.4) | |
| 373 | - _x = _x + (coord)((pB->_x-_x)*0.2 + (pF->_x-_x)*0.4); | |
| 374 | - _y = _y + (coord)((pB->_y-_y)*0.2 + (pF->_y-_y)*0.4); | |
| 375 | - _z = _z + (coord)((pB->_z-_z)*0.2 + (pF->_z-_z)*0.4); | |
| 376 | - } | |
| 366 | +// if (_dispatch_index == 0) { //N_DISPATCH_AT_ONCE の節目が角張るので平均化を強くした | |
| 367 | +// _x = _x + (coord)((pB->_x-_x)*0.4 + (pF->_x-_x)*0.5); | |
| 368 | +// _y = _y + (coord)((pB->_y-_y)*0.4 + (pF->_y-_y)*0.5); | |
| 369 | +// _z = _z + (coord)((pB->_z-_z)*0.4 + (pF->_z-_z)*0.5); | |
| 370 | +// } else { | |
| 371 | +// //中間座標に再設定 | |
| 372 | +// //座標の重みは、(ひとつ前, 自身, 一つ先)= (0.2, 0.3, 0.4) | |
| 373 | +// _x = _x + (coord)((pB->_x-_x)*0.2 + (pF->_x-_x)*0.4); | |
| 374 | +// _y = _y + (coord)((pB->_y-_y)*0.2 + (pF->_y-_y)*0.4); | |
| 375 | +// _z = _z + (coord)((pB->_z-_z)*0.2 + (pF->_z-_z)*0.4); | |
| 376 | +// } | |
| 377 | + | |
| 378 | + _x = (pB->_x + _x + pF->_x) / 3; | |
| 379 | + _y = (pB->_y + _y + pF->_y) / 3; | |
| 380 | + _z = (pB->_z + _z + pF->_z) / 3; | |
| 381 | + | |
| 382 | + | |
| 383 | + //TODO:平均すると先がへにょる | |
| 384 | + //TODO:平均しないとぎざぎざになる | |
| 377 | 385 | |
| 378 | 386 | //速度ベクトルも平均化してギザギザ対策 |
| 379 | 387 | // GgafDx::NaviVehicle* pF_pNaviVehicle = pF->getNaviVehicle(); |
| @@ -384,8 +392,12 @@ throwCriticalException("pLeaderChip_AimInfo_ | ||
| 384 | 392 | // pNaviVehicle->_velo_vc_z = pNaviVehicle->_velo_vc_z + (velo)((pB_pNaviVehicle->_velo_vc_z - pNaviVehicle->_velo_vc_z)*0.2 + (pF_pNaviVehicle->_velo_vc_z - pNaviVehicle->_velo_vc_z)*0.4); |
| 385 | 393 | // pNaviVehicle->_velo = pNaviVehicle->_velo + (velo)((pB_pNaviVehicle->_velo - pNaviVehicle->_velo)*0.2 + (pF_pNaviVehicle->_velo - pNaviVehicle->_velo)*0.4); |
| 386 | 394 | // } |
| 395 | + GgafDx::NaviVehicle* pF_pNaviVehicle = pF->getNaviVehicle(); | |
| 396 | + if (pNaviVehicle->_velo > 0 && pF_pNaviVehicle->_velo > 0 ) { | |
| 387 | 397 | |
| 388 | 398 | |
| 399 | + } | |
| 400 | + | |
| 389 | 401 | |
| 390 | 402 | } else { |
| 391 | 403 | //レーザー末尾処理 |
| @@ -32,7 +32,7 @@ namespace VioletVreath { | ||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | /** レーザーの同時dispatch数 */ |
| 35 | -#define N_DISPATCH_AT_ONCE (3) | |
| 35 | +#define N_DISPATCH_AT_ONCE (2) | |
| 36 | 36 | /** |
| 37 | 37 | * 自機クラス |
| 38 | 38 | * @version 1.00 |
| @@ -29,5 +29,9 @@ onDispatch() コールバック共通化 | ||
| 29 | 29 | 現在の速度が多少ブレても、加速度ベクトルがブレないようにすればよいのでは? |
| 30 | 30 | *8 を *2にしてみてはどうか? |
| 31 | 31 | 逆に *8 を *30 にしてみてはどうか? |
| 32 | +BUSHINを止めてみる | |
| 33 | +N_DISPATCH_AT_ONCE が 1 で 分身を回さない場合はギザギザはおきない | |
| 34 | +N_DISPATCH_AT_ONCE が 1 で 分身を回すとギザギザ(の元)が起きる | |
| 35 | +N_DISPATCH_AT_ONCE が 3 で 分身を回さない場合はギザギザはおきない | |
| 36 | +つまりギザギザの原因は分身を回す(=向きから角度の精度が甘い) | |
| 32 | 37 | |
| 33 | -レーザーの先がふにゃる。 |