Log in or register to post comments

Play video on texture using a custom 3d gameobject as play

November 27, 2012 - 11:30pm #1

Hi guys! I got a small problem here.

My app is fully working and the video plays fine but what i need is something slightly different.

 

I got a 3d PLAY button and once i click on it i have a 3d animation that reveals the "screen" with the video texture on it.

i need the video to play only when i click the 3d button not when i click on the video itself.

 

Any idea?

 

Cheers

 

Play video on texture using a custom 3d gameobject as play

November 30, 2012 - 12:53am #3

This is great! THank you so much!

Play video on texture using a custom 3d gameobject as play

November 29, 2012 - 1:42pm #2

You can modify the VideoPlaybackController class to accomplish this. Rather than have PickVideo check for touched Video instances, use your 3D model, with an attached Collider, and pass back the associated Video instance to be played. 

e.g.

    // Find the video object under the screen point

    private VideoPlaybackBehaviour PickVideo(Vector3 screenPoint)

    {

        VideoPlaybackBehaviour[] videos = (VideoPlaybackBehaviour[])

                FindObjectsOfType(typeof(VideoPlaybackBehaviour));

 

        Ray ray = Camera.main.ScreenPointToRay(screenPoint);

        RaycastHit hit = new RaycastHit();

 

        foreach (VideoPlaybackBehaviour video in videos)

        {

            if (video.collider.Raycast(ray, out hit, 10000))

            {

                return video;

            }

        }

 

        return null;

    }

Log in or register to post comments