MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / updateShipRotation

Method updateShipRotation

Source/PlayerObject.cpp:359–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359void 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
381void PlayerObject::spawnPortalCircle(ax::Color4B color, float radius)
382{

Callers 1

updateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected