Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
How to balance weights on a 2D plane

I'm working on a small Unity hobby project where I'm trying to program thrusters for a spaceship in 3D space. The thrusters are working, but I have some issue with matching the centre of thrust with the center of mass. I want the thrusters to automatically adjust their strength based on their position relative to a movement direction.

When looking at the problem a bit more simplistically, I'm left with this situation:

I have a random amount of weights placed on a 2D plane at random locations. The mass of each weight is unknown, and the center of mass of all weights must be at 0,0.

How do I calculate the mass of each weight?

Example of weight placement

So far, I'm visualising the problem as a 2D space where the center of mass must be 'pulled' to 0,0 by increasing the mass of the weights. But I can't figure out an algorithm to do this accurately, and with the least amount of mass delta between weights.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The problem as you've described is underconstrained. With m1, m2, etc as the masses and (x1, y1), (x2, y2), etc as the coordinates:

m1 * x1 + m2 * x2 + m3 * x3 + m4 * x4 = 0
m1 * y1 + m2 * y2 + m3 * y3 + m4 * y4 = 0

Set m3 and m4 to zero and it's pretty easy.

You have four free variables (4 masses) to make match two equations. The only complication is that mass probably has to be positive for all values.

A pretty optimal way to solve this in your case is to pick a default mass, then try for each pair of masses (m1, m2), (m1, m3), (m1, m4), (m2, m3), etc, solve the equation with the other masses set to the default mass.

So, if default mass is 5kg, set m3 = 5kg and m4 = 5kg, solve for m1 and m2, getting say, m1 = 3kg and m2 = 6kg. Repeat this for all pairs of masses. Pick the pair that deviates the least from the default mass and doesn't go negative.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda