FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • 2D orbit an orbiting body without ellipsegabriel__
    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 e
     

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.

How do I move a point in a specific direction in 3D Space?

I know how to move a point in a direction in 2D space it's like this:

pointX += sin(angle) * movementSpeed;
pointY += cos(angle) * movementSpeed;

How do I do the same in 3D space assuming the angle variable is replaced with pitch, yaw, and roll variables and the addition of a pointZ variable?

❌
❌