So I have a bike texture with a polygon collider attached to it, then I have to wheels that are rotated when I press W or S, and at the same time the bike goes back and forth respectively to the key pressed down. But there is one thing that is not working properly, when I try to go up on slopes the wheels tend to be off quite a bit from the original position they had, and I’ve tried fixing the position with sliders, scripts, you name it. And they also have rigid bodies because if I don’t have rigid bodies on them their circle colliders radius grow for some reason and that’s also problematic, but solved with a rigid body. But my question is how do I keep the wheels in place no matter how much they are tilted/angled? Keep in mind that this is a 2D game and that the wheels are separated from the bike body, meaning that the bike itself has no wheels from the beginning and that’s when the external textures I made come in and act as wheels and rotate when told to do so.
Hi I did a 2D Vehicle Control for the asset store, in my script the WheelJoint2D are created automatic, but some tips for your vehicle are:
Make your wheels child of the carbody. The carbody and the wheels need a rigidbody2d. In your carbody add 2 WheelJoint2D. In the WheelJoint2D drag and drop you wheel to connected rigidbody option. Adjust the anchor option of the WheelJoint2D. Your wheel object dont need WheelJoint2D, just your carbody.