Hello everyone!
I need to rotate a wheel, by it’s center origin, to make my 2d car move.
I didn’t found anything…
I did this, but it only pushes the wheel, and is not good
rigidbody2D.velocity = new Vector2(move * 10, rigidbody2D.velocity.y);
Help me !
Also
float rot = Input.GetAxis("Horizontal") * 20;
transform.Rotate(0, 0, rot);
This will rotate the sprite, but it doesn’t affect anything
There is no WheelCollider for 2D.
It’s worth a shot to try a normal Circle collider, but if that doesn’t work, you’ll have to roll your own WheelCollider2D and there’s no CircleCast in Physics2D like SphereCast in Physics, which makes it harder.
So, let’s try Circle-Colliders:
- Import the Physic Materials package
- Put “Rubber” on your CircleColliders and “Wood” on your floor.
float rot = Input.GetAxis("Horizontal") * speed;
backTire.rigidbody2D.AddTorque(rot);