Search Unity

rigidbody.worldCenterOfMass

Discussion in 'Scripting' started by antenna-tree, Aug 7, 2006.

  1. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    I can get rigidbody.centerOfMass to work fine, but rigidbody.worldCenterOfMass gives me the error below. I'm doing something as straightforward as..
    Code (csharp):
    1.  
    2. someObject.rigidbody.worldCenterOfMass = Vector3 (0, 0, 0);
    3.  
    Am I missing something simple here? It looks to me like the variable doesn't exist?
     

    Attached Files:

  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    worldCenterOfMass is a read-only property (the docs did not say that... adding a note now). In 1.5.1 development version the error message is better as well (it just says that: "Property blah blah is read only".

    Try using centerOfMass with a Transform.InverseTransformPoint to get the point from world to local space.