Translating Video Pixel Coordinates to GUI

Hey Guys,

My friend asked me to help him on a project he wants to make. I decided a game engine was the best thing to use for what he wanted to do, and I know some Unity, so I thought I’d help him out and give it a go. Basically what he’s making is a video installation where people press buttons to interact with a video. A symbol appears somewhere in the video, the user presses the corresponding button, and a message comes up.

I’ve been using AVPro Video to play the video files to the GUI layer, and that’s working. To track the symbols he wants to come up over the video, I have x/y coordinates from the video for where I want the symbols to come up. Basically, the top left pixel of the video is 0,0, and the bottom right pixel is 1920,1080. Using that, I can figure out where the symbol should appear on the video.

I have the video playing full screen at 1920x1080 and the sprites that come up on the video are UI Image objects placed over it. I’ve been trying to find a way to convert the pixel x/y values to corresponding x/y values on the GUI layer. I was trying to use the position of it’s rect transform to accomplish this, but it hasn’t really been lining up so far.

I noticed that the GUI Layer in Unity uses a coordinate system that’s different from the video pixels. Center is 0,0 on the GUI layer, and anything to the left/right or up/down from there adds or subtracts from that center value of zero.

I know this is kind of vague, but I was wondering if anyone here could suggest how they would go about positioning a 2d Image UI object over a certain pixel location of a fullscreen video on the GUI layer.

Any step in the right direction would be greatly appreciated.

Thanks,

Joe

use RectTransform.anchoredPosition