- Home /
How to make my rotating sphere sticky?
Hi, I have a cube and a sphere both made of Rubber and both have a rigidbody.
Here are the cube's parameters that I've changed from default:
Freeze position on Z
Freeze Rotation on every axis
Here are the sphere's parameters that I've changed from default :
Does not use gravity
Is kinematic
I place my cube centered above my sphere and I let the cube fall on the sphere. If I apply no rotation, the cube will stay balanced on the sphere and will not move. But what I want to do for my game is I want the sphere to rotate on itself so that the cube can't stand on it.
To do this, I uses a script that changes the rotation of the sphere on each frame :
public int rotationAnglePerSecond = -30;
// Update is called once per frame
void Update () {
transform.Rotate(0, 0, Time.deltaTime*rotationAnglePerSecond);
}
With this script, you'll find out that the sphere turns slowly and pushes the cube next to it like it should. But my problem comes when I increase the rotation speed. Instead of making the cube fall more quickly, the cube just slips on the sphere and takes a long time before falling off (try with -180 instead of -30).
I don't understand why my rotating sphere affects less the cube when it's rotation speed is increased. They are both made of rubber, shouldn't they stick together instead of slipping?
Answer by RacingRapist · Jul 28, 2013 at 09:54 PM
I found the problem! I must use AddTorque instead of rotating my sphere. And my sphere must not be kinematic, otherwise the torque won't be calculated.
Answer by DaveA · Jul 28, 2013 at 05:45 PM
If I'm not mistaken, I haven't checked this, 'rubber' refers to the bounciness, not the stickiness. Try increasing the friction. You might also want to look into WheelCollider
The rubber is sticky and not bouncy (friction=1 and bounciness=0). I also tried the WheelCollider, but the collisions are very very strange, like the wheel does not have a circular shape...
Isn't there a simple explanation of why the cubes slips over the sphere? This isn't realistic physics...