I'm trying to create a simple vehicle and make it run on a terrain (from sprites + PolygonCollider2D).

  • I imported a chassis sprite with Rigidbody2D and PolygonCollider2D.
  • Then I imported a wheel with Rigidbody2D and CircleCollider2D.
  • I joined them with a DistanceJoint2D in the wheels and added the chassis as the parent.

But the wheel collides with terrain but not with the car. And you guys can also see the car/chassis collides with the terrain.

circle collider 2d sometime works, sometime it doesn't

How can I solve this?

  • \$\begingroup\$ It looks to me like you want a Fixed Joint for that situation, not a Distance Joint. You've also left the "Enable Collision" box unchecked on your joint - was that deliberate? \$\endgroup\$ – DMGregory Feb 9 at 16:04
  • \$\begingroup\$ @DMGregory with fixed joint chassis/car doesn't move a bit, cause then the wheel doesn't rotate. and I wasn't sure about the enable-joint, so i left it default. \$\endgroup\$ – Maifee Ul Asad Feb 9 at 16:21
  • 1
    \$\begingroup\$ Then perhaps try a Hinge Joint? \$\endgroup\$ – DMGregory Feb 9 at 16:21
  • \$\begingroup\$ @DMGregory thats working, but can you tell please why is that ?? \$\endgroup\$ – Maifee Ul Asad Feb 9 at 16:33
  • 1
    \$\begingroup\$ You have access to your project, and can share screenshots that show how you set it up. I don't have those. And I don't really need more rep. 😉 \$\endgroup\$ – DMGregory Feb 10 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.