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

188
Visualizações
Child position is moving along with parent, but not actually moving (moving platform)

So I have been stuck on this for the last few days, researched and tried a lot of things but still can't figure this out.

I have a player with a Rigidbody and a moving platform with a Rigidbody as well. The platform is moving back and forth and I want the player to stay on it when he's on.

So when the player jumps on the platform, the platform become it's parent. This is working fine, no problem on that end.

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Moving Platform"))
    {
        transform.parent = collision.gameObject.transform;
    }
private void OnCollisionExit2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Moving Platform"))
    {
       transform.parent = null;
    }
}

The thing is, since the player has a Dynamic RigidBody, it looks like the movement of it's parent does not affect him. I can see his position moving in the inspector, but it's not really moving in the game.

When I set the body type to kinematic, the player stays on the platform but then I can't find a way to actually move while on it. So he gets basically stuck on the platform.

Is there an easy fix for this ? Or should I completely change the way I am making these moving platforms.

(BTW, every movements are handled with physics)

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

0

When you move the player sometimes it detach from collision even with small margin and will give weird results. try Physics2d.OverlapCircle instead.

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