void Start () { myTransform = transform; if (shape == null) shape = GetComponent<BtShape> (); shape.AddObserver (changedShape); myRigidBody = createRigidBody (shape.Shape, myTransform, mass); if (isTrigger) myRigidBody.CollisionFlags |= BulletSharp.CollisionFlags.NoContactResponse; if (isKinematic) myRigidBody.CollisionFlags |= BulletSharp.CollisionFlags.KinematicObject; else if (Mathf.Approximately (mass, 0f)) myRigidBody.CollisionFlags |= BulletSharp.CollisionFlags.StaticObject; if (world == null) world = BtWorld.main; world.World.AddRigidBody (myRigidBody); }
void Awake () { if (shape == null) shape = GetComponent<BtShape> (); }