Search Unity

Why Does Changing a Collider Affect Rigid Body Physics?

Discussion in 'Scripting' started by John-B, Nov 17, 2012.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Why does changing a collider, say from a box to a capsule, change the way the object is affected by a force? The same is true for adding or removing a collider. Even changing the size of a collider can have a significant effect. The rigid body stays the same, and the objects are flying so there's no friction involved. But even very slight changes in one of the attached colliders can cause the object to not travel as far with the same force, or not spin as much with the same torque force.

    I thought the rigid body determined how a body reacts to applied forces while the collider only affects the object's interaction with other objects.
     
    RemDust likes this.
  2. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    The problem I'm trying to solve involves changing from box to capsule colliders. I got everything working perfectly physics-wise with 5 box colliders attached to each object. But on occasion, even though the colliders are very thin, an object would land on its edge. Sort of like a coin toss, it would never land on edge in real life. I thought switching to capsule colliders with round edges would solve this problem. But when I switched, the objects started behaving completely differently. I've been tweaking and tweaking, and still can't get them to behave the same with capsules as with boxes.
     
  3. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    I think the rigidbody uses the colliders to figure out where it's mass is at.
     
  4. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Moving the center of mass would explain why rotation is affected. But mass is set in the rigid body. So I wouldn't think changing center of mass would affect how far it travels with a given force.
     
  5. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    The amount an object spins for a given Torque is a function of its mass and physical dimensions. Rigidbody.inertiaTensorRotation (http://en.wikipedia.org/wiki/Moment_of_inertia) is calculated from the Collider but you can set it yourself. Make sure your Drag, AngularDrag are the same as your other object as well - they also effect flying objects. And check the scale you are using if you don't set your tensors.
     
    Last edited: Nov 18, 2012
    Snake-M3, sh4850 and (deleted member) like this.
  6. brian1gramm1

    brian1gramm1

    Joined:
    Sep 15, 2017
    Posts:
    56
    Very old topic, but I'm just learning physics. I created a space game and use AddForce and AddTorque to push the ships forward and turn the ships respectively. However, when I removed my model for a bigger model, it acted just like John's example. I had to add a significantly greater torque to rotate the ships left/right, but the force for forward movement was not affected. How do I make it standard torque regardless of the size of the ship? Thanks.
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Use ForceMode.Acceleration.
    And generally use accelerations instead of forces.