コード例 #1
0
    IEnumerator jumper()
    {
        while (true)
        {
            yield return(new WaitForSeconds(Random.Range(0.01f, 1f)));

            var angle = Random.insideUnitSphere;
            var scale = Random.Range(0.000001f, 0.001f);
            angle.Scale(scale);
            Rigidbody push = SentientListener.randomProp().GetComponent <Rigidbody>();
            push.AddForce(angle, ForceMode.VelocityChange);
            push.AddTorque(Random.insideUnitSphere.Scale(Random.Range(0, 0.3f)), ForceMode.VelocityChange);
        }
    }
コード例 #2
0
ファイル: Controller.cs プロジェクト: edeetee/scutter
    //TODO geiger
    void Awake()
    {
        spring        = gameObject.AddComponent <SpringJoint>();
        spring.spring = 100f;
        spring.damper = 10f;
        //spring.minDistance = 0.01f;
        spring.autoConfigureConnectedAnchor    = false;
        GetComponent <Rigidbody>().isKinematic = true;

        hand = transform.GetComponentInParent <Hand>() ?? transform.GetComponent <Hand>();

        GameObject randObj = SentientListener.randomProp();

        spring.connectedBody = randObj.GetComponent <Rigidbody>();
        //setTarget(randObj);
    }