Newer
Older
fall / FallUnity / Assets / Utils / Utils.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class Utils
{
    /*
    public static float GetDepthInOrthoCam(GameObject g, Camera c)
    {
        return Vector3.Dot(g.transform.position - c.transform.position, c.transform.forward);
    }

    public static float GetDepthIn(GameObject g, Vector3 pos, Vector3 forward)
    {
        return Vector3.Dot(g.transform.position - pos, forward);
    }

    public static Vector2 GetPosInOrthoCam(GameObject g, Camera c)
    {
        float x = Vector3.Dot(g.transform.position - c.transform.position, c.transform.right);
        float y = Vector3.Dot(g.transform.position - c.transform.position, c.transform.up);
        return new Vector2(x, y);
    }

    public static Vector2 GetPosIn(GameObject g, Vector3 pos, Vector3 right, Vector3 up)
    {
        float x = Vector3.Dot(g.transform.position - pos, right);
        float y = Vector3.Dot(g.transform.position - pos, up);
        return new Vector2(x, y);
    }
    */
}