Пример #1
0
    private void IntersectPlane()
    {
        Vector3 screenCenter = new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f);
        Ray     ray          = camera.ScreenPointToRay(screenCenter);

        float enter = 0.0f;

        if (groundPlane.Raycast(ray, out enter))
        {
            Vector3 hitPos = ray.GetPoint(enter);               //Get the point that is clicked

            rig.setTarget(hitPos);

            robot.setTarget(rig.GetToolPosition(), rig.GetToolOrientation());
        }
    }