So my goal is ultimately to simulate a PID controlled wheel for a ball balancing on top of it, for those who know something about control systems. Nevertheless for the beginning, I want to make a wheel controlled by a human, in this case me, steering the direction of rotation of the wheel with the left and right arrow keys.
So I imported the wheel from a CAD model as an .obj file and made the ball in Unity. I implemented the controls for the wheel like this:
I added a mesh collider to the wheel and a sphere collider to the ball. I can rotate the wheel, but it does not affect the behavior of the ball. I tried applying physics materials and added maximum friction. Even trying the same thing with two cylinders from Unity does not work.
So, how can I achieve the frictional torque from the wheel?
Side note: The custom wheel is not a rigid body because, it would delete the mesh collider and add a very primitive collider to it.
Thank you in advance!
Do mind that transform.Rotate does rotate the object, but does not affect physics engine itself. No torque is added this way to the rigidbody. You need to have rigidbody and then use rb.AddTorque to make the physics engine rotate the object.
@Shrimpey Thank you for answering! Ok, I will keep this in mind. I tried to make a rigid body out of my CAD wheel model, and turned out that the mesh collider would turn to a primitive collider like a cylinder and “lose” the actual geometry for colliding with the ball. How can I apply Rigid Body and keep the complex collider as it is ? If this doesn’t work would I have to make it with a normal cylinder geometry?
First time poster here. Beginner unity designer.
I found this thread that after running into [what I think is] a similar issue. I’ve made a hamster wheel kinematic and a few rigid body objects with physics materials. They physically interact with the inner wall of the wheel correctly when they drop initially, but rotating the wheel doesn’t provide friction to jostle the objects. Could someone offer me some guidance? Again, I’m a turbo-beginner. Thank you.