// Update is called once per frame void Update() { float y = transform.localPosition.y - m_initialY; float dt = Time.deltaTime; dt = Mathf.Clamp(dt, 0.0f, 0.1f);; m_velocity += dt * m_gravity; y += dt * m_velocity; if (y <= 0.0f) { m_velocity = -m_velocity * m_bounce; if (m_spinner != null) { m_spinner.Dampen(m_bounce); } if (m_velObject != null) { m_velObject.Dampen(m_bounce); } y = 0.0f; } Vector3 pos = transform.localPosition; pos.y = y + m_initialY; transform.localPosition = pos; }