コード例 #1
0
    public virtual void Start()
    {
        rb.constraints = RigidbodyConstraints.FreezeRotation;
        rb.useGravity  = false;

        attractor = GameObject.Find("Planet").GetComponent <FakeGravity>();
    }
コード例 #2
0
    private void Start()
    {
        _objRigidbody             = GetComponent <Rigidbody>();
        _objRigidbody.constraints = RigidbodyConstraints.FreezeRotation;
        _objRigidbody.useGravity  = false;
        _objTransform             = transform;

        if (_attractor == null)
        {
            _attractor = GameObject.FindGameObjectWithTag("World").GetComponent <FakeGravity>();
        }
    }