UI question and object resizing


#1

Hello Zappies.

  1. I wonder how can I have a an object and then resize it during the experience like in the 3D photo example but without the photo buttons.
  2. Regarding the UI. How can I stick buttons to the camera?

Any help is appreciated.
Thank you.
Milenne


#2

Hi Milenne,

Being able to take the functionality from the 3D Photofeature and use it in your own project has been discussed here - Pinch to zoom + follow finger.

Can you elaborate on “sticking buttons to the camera”? Do you mean having elements on the screen as opposed to 3D space or a tracking image?

Thanks,
Mark


#3

Thanks Mark. I will try that: pinch to zoom.

The “sticking buttons to camera” I mean having the elements on the screen (a fixed UI in the bottom for example).

Also, One more question if I may. How can I loop a video playing?

Thanks. Appreciated.:wink:
Milenne


#4

Hey Milenne,

You can fix elements to the screen by changing the objects coordinate system to screen space, we’ve got a tutorial video on coordinate systems which should help you out here - https://docs.zap.works/studio/tutorials/uicoordinatesystems/

Video looping depends on what type of video implementation you’re using but the general rule of thumb is to listen for the finish event of the video and set it to restart, this is mentioned in the following article - https://docs.zap.works/studio/audio-and-video/#a11-looping

Hope this helps :slight_smile:

Thanks,
Mark


#5

thanks Mark
I saw this page but I am not sure where to put this: “listen for the finish event of the video and set it to restart”
Where is the video event and Where do I need to go to set it to restart?
Thanks. Sorry, coding is not something I control a lot. I have been looking for this video event and don’t know where to find it.
Regards


#6

No worries,

Let’s use the example of an embedded MP4 video.

If you drag the video node in the Hierarchy into a script and select to add an event handler for the finish event, you can then add the restart code within that resulting function.

This process can be seen in the screenshot below, the code from line 20 - 24 is the end result with the code afterwards showing how it is achieved when dragging in the video node.

The project for this can be found below for you to take a look yourself, it’s simply a looping MP4 video :slight_smile:

test_embed_mp4_video.zpp (14.0 MB)

Thanks,
Mark


#7

Mark,

Did something change with studio since this post?
The finish does not fire at the end of the video in you demo.

Steve

Edit. Sorry I was testing on windows zappar. I works on my device but do not on the pc.