| 357 | } |
| 358 | |
| 359 | void PlayerObject::updateShipRotation(float dt) |
| 360 | { |
| 361 | float angleRad, curAngleDeg, newAngleDeg; |
| 362 | |
| 363 | Vec2 pos = getPosition(); |
| 364 | |
| 365 | Vec2 d = (pos - m_prevPos) / dt; |
| 366 | |
| 367 | if (GameToolbox::SquareDistance(0, 0, d.x, -d.y) >= 1.2f) |
| 368 | { |
| 369 | angleRad = atan2f(-d.y, d.x); |
| 370 | |
| 371 | angleRad *= _mini ? 1.2f : 1.f; |
| 372 | |
| 373 | curAngleDeg = getRotation(); |
| 374 | |
| 375 | newAngleDeg = GameToolbox::iSlerp(curAngleDeg, angleRad * 57.296f, 0.15f, dt / 60.f); |
| 376 | |
| 377 | setRotation(newAngleDeg); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | void PlayerObject::spawnPortalCircle(ax::Color4B color, float radius) |
| 382 | { |