예제 #1
0
    /// <summary>
    /// Updates the passed in Stackables transform by moving the object to be centered above the player
    /// </summary>
    /// <param name="stackable"></param>
    private void StackOnTop(Stackable stackable)
    {
        Vector3 stackableBottomCenter = stackable.GetBottomCenter();
        Vector3 playerTopCenter       = this.GetTopCenter();
        Vector3 targetTranslation     = playerTopCenter - stackableBottomCenter;

        stackable.transform.Translate(targetTranslation, Space.World);
    }