public void HandleInput(Vector3 screenPosition)
    {
        if (jointTrans == null)
        {
            return;
        }
        var worldPos = Camera.main.ScreenToWorldPoint(screenPosition);

        jointTrans.position = CameraPlane.ScreenToWorldPlanePoint(Camera.main, dragDepth, screenPosition);
    }
예제 #2
0
    private void CreatePlane()
    {
        var cam         = Camera.main;
        var planePoints = new CameraPlane(cam, cam.farClipPlane - 1f);
        var rotation    = Quaternion.LookRotation(cam.transform.forward, cam.transform.up);

        renderPlane = PrimitiveCreatorUtil.CreatePlane("VideoRenderPlane", planePoints.LowerLeft, rotation, PrimitiveCreatorUtil.Orientation.Vertical, 1, 1,
                                                       planePoints.Width, planePoints.Height, PrimitiveCreatorUtil.PlaneAnchorPoint.BottomLeft, false, movieMaterial);
        renderPlane.transform.parent = cam.transform;
    }
예제 #3
0
    public void HandleInput(Vector3 screenPosition, int touchIndex)
    {
        if (jointTrans == null)
        {
            return;
        }
        Vector3 worldPos  = Camera.main.ScreenToWorldPoint(screenPosition);
        Vector3 targetPos = CameraPlane.ScreenToWorldPlanePoint(Camera.main, dragDepth, screenPosition);

        Debug.LogFormat("targetPos = {0} ; worldPos = {1}", targetPos, worldPos);
        jointTrans[touchIndex].position = worldPos;
    }
    public void HandleInputBegin(Vector3 screenPosition)
    {
        var        ray = Camera.main.ScreenPointToRay(screenPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Interactive"))
            {
                dragDepth  = CameraPlane.CameraToPointDepth(Camera.main, hit.point);
                jointTrans = AttachJoint(hit.rigidbody, hit.point);
            }
        }
    }
예제 #5
0
    public void HandleInputBegin(Vector3 screenPosition, int touchIndex)
    {
        var        ray = Camera.main.ScreenPointToRay(screenPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
//			if (hit.transform.gameObject.layer == LayerMask.NameToLayer ("Interactive")) {
            dragDepth = CameraPlane.CameraToPointDepth(Camera.main, hit.point);
            Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPosition);
            jointTrans[touchIndex] = AttachJoint(hit.rigidbody, worldPos);
            Vector3 targetPos = CameraPlane.ScreenToWorldPlanePoint(Camera.main, dragDepth, screenPosition);
            Debug.LogFormat("targetPos = {0} ; worldPos = {1}", targetPos, worldPos);
//			}
        }
    }
예제 #6
0
    public void HandleInputBegin(Vector3 screenPosition, int touchIndex)
    {
        var        ray = Camera.main.ScreenPointToRay(screenPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            dragDepth = CameraPlane.CameraToPointDepth(Camera.main, hit.point);
            if (hit.rigidbody != null)
            {
                jointTrans[touchIndex] = AttachJoint(hit.rigidbody, hit.point);
            }
            else if (hit.transform.GetComponent <Rigidbody2D>() != null)
            {
                jointTrans[touchIndex] = AttachJoint(hit.transform.GetComponent <Rigidbody2D>(), hit.point);
            }
        }
    }