Guys, I’m developing a golf game with real scale. But physics does not behave the same way on smaller scales.
I’ve applied the same thrust and torque on the 3 balls. The only difference is the scale: 1x, 0.1x and 0.01x.
All spheres should have the same behavior, right, so why only the larger sphere behaves the way it should? The terrain and spheres have maximum friction, so why do they never get to attriction and keeps spinning?
I’ve considered scaling everything by 100x but it is messes the physics and game logic even more. Ideas?
Don’t actually “scale” the transforms. Rigidbodies do not like to be scaled. Simply scale the mesh in a child game object (or better make the mesh the right scale to begin with). Then change the radius on the SphereCollider itself.
As far as my tests go this is not a rigidbody scale issue but a Sphere Collider radius issue. I’ve worked on a custom mesh for a 1x1x1 scale but the effects are the same. I can’t use Mesh Collider unforunatelly…
You’re experiencing a combination of problems in unison I think.
First, the video you’ve shared shows the transform has been scaled. The mesh itself doesn’t really matter, I only mentioned fixing the mesh scale because it’s technically more efficient. What’s important is that the transform your Rigidbody/Collider is attached to needs to be (1,1,1) and then adjust the Sphere Collider radius to change the collision size.
Second, you may be experiencing a problem with fast moving small objects. Try setting the rigid body collision mode to ContinuousDynamic.
That being said, very small objects may still have strange behavior. But I don’t think you should be experiencing this at the 0.1 scale (maybe the 0.01 scale).
You might just be hitting the limits of PhysX in that case. You can try messing with the Fixed time step to see if increasing it makes anything better. Or try increasing the mass. PhysX does have it’s limitations due to favoring efficiency over range (in terms of mass, scale, and distance).
Thrust and torque are forces right? So they what accelerate the bodies in inversely portion to their mass (which PhysX prob basses on size and density or something?)
So you have a rocket engine hat you use to impart thurst on an Elephant, just enough to push it along at a human walking pace, now you swap out the elephant for a mouse and after refueling the rocket, wait where did the mouse go?
nat42 makes a good point. I was assuming that by “same thrust and torque” you meant you were using ForceMode.VelocityChange for those methods. If not, try your experiments with that change.
Physics behaves weirdly on small scales. I’ve made a 1x1x1 scale mesh (no scaling) with a 0.005 radius sphere collider. So I’m assuming all calculations are based in the collider radius related to object scale.
The only thing that made it work was to set rigidbody.maxAngularVelocity to an absurd value like 50000 (why?!). Then the ball started to roll back as expected.
Probably because small objects tend to generate a lot more spin when colliding with surfaces (or if you’re applying the same torque versus a larger mass). rigidbody.maxAngularVelocity is not a physically realistic property. It specifically limits realistic spinning for the sake of keeping objects in a controllable range. So with something like a golf ball it’s probably altering the angular velocity so much that the end linear behavior is also noticeably different.