Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!