Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda