Search Unity

Error unknown from "Actor::updateMassFromShapes"..

Discussion in 'Scripting' started by chips, Jan 17, 2008.

  1. chips

    chips

    Joined:
    Nov 30, 2007
    Posts:
    138
    Hi there!
    I'm having this error:

    I have no idea what is it or where is this happening. But with this problem I can't even start my game.

    TXS n []s Chips
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I've seen an error something like that when trying to use a rigidbody with a mesh collider that isn't closed.

    --Eric
     
  3. chips

    chips

    Joined:
    Nov 30, 2007
    Posts:
    138
    Yes, I'm using dozens of mesh colliders with rigidbody, but it wasn't givin' me any problem till now...

    Does anyone know if it is a wrong thing to be done?

    []s Chips
     
  4. MatthewW

    MatthewW

    Joined:
    Nov 30, 2006
    Posts:
    1,356
    What are you trying to do?
     
  5. chips

    chips

    Joined:
    Nov 30, 2007
    Posts:
    138
    I built a door that cracks and blow in pices when you hit a trigger in frnt of it. So I've made all of it's pices a rigidbody with kinematic. When the trigger is activated the pices were thrown away with addForce and addTorque.

    Code (csharp):
    1.  
    2.         rigidbody.isKinematic = false;
    3.         rigidbody.AddForce(Vector3(0, Random.Range(0,5), Random.Range(0,5)),ForceMode.Impulse);
    4.         yield WaitForSeconds(0.3);
    5.         rigidbody.AddTorque ( 0.5, 1, 0.3, ForceMode.Impulse );
    6.  
    but the thing is that is hasn't worked in a very specific door (witch cracks in two diferente times) and the other tipes ware working fine.

    []s Chips
     
  6. chips

    chips

    Joined:
    Nov 30, 2007
    Posts:
    138
    So... Anyone have another tip 4 me? I'm still having this problem. :(
    And I'm not planning to destroy my door...

    []s Chips
     
  7. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    As I understand it, the method of calculating the tensor of inertia would be messed up if there were gaps in the mesh (there should be a better error message, though!) If it is possible to use closed meshes then it will likely fix the problem.

    However, you can also set the tensor from a script using the Rigidbody.inertiaTensor property. The docs suggest that the physics engine won't try to calculate the tensor if you set it yourself, and therefore the error shouldn't occur.

    As for the value of the tensor, it's a bit complicated to estimate it accurately, but you can get a reasonable result with trial and error. Basically, it is the degree to which the object resists being turned around each axis. If you think of a broom handle, it takes less effort to roll it between your fingers than it does to twirl it around its centre. If a broom handle object's mesh had its length lying along the z-axis then it would be easy to roll around this axis (low tensor z value) than around the x and y (higher values).