FreshRSS

Zobrazení pro čtení

Jsou dostupné nové články, klikněte pro obnovení stránky.

2D orbit an orbiting body without ellipse

I have a monster (boss) that spawns a minion (m1) which orbits the boss. m1 can spawn its own minion (m2) which orbits m1. This creates a situation where m2 is orbiting m1 and m1 is orbiting the boss.

This results in m2 having an elliptical orbit. I'm wondering if there is some way to make it such that m2s orbit is always circular just like how m1 orbits the boss.

the orbital movement calculation is done as such, and each frame the monsters are updated about where their origin is (ex, m2 knows each frame where m1 is, and that is assigned as m2's origin to revolve about):

position.x = origin.x + radius * std::cos(angle);
position.y = origin.y + radius * std::sin(angle);

if anyone has any ideas, please share. thanks. I feel like this is impossible but figured I'd ask anyways.

❌