コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        // if we are simulating
        if (Simulating)
        {
            // get good scaled delta time so things dont move too slow
            float GoodDeltaTime = TimeMultiplier * Time.deltaTime;
            // update objects
            GravityObject.CalculateForces(CreatedObjs);
            GravityObject.UpdateObjects(CreatedObjs, GoodDeltaTime);
            GravityObject.HandleCollisions(CreatedObjs, GoodDeltaTime);
            GravityObject.HandleRots(CreatedObjs, GoodDeltaTime);


            // If we press F, speed up the sim otherwise set to default
            if (Input.GetKey(KeyCode.F))
            {
                TimeMultiplier = 4000;
            }
            else
            {
                TimeMultiplier = 40;
            }
        }
    }