What's the relation of SwiftUI frames' sizes and RealityKit Entities sizes

Currently I want to recreate a window which is similar to system window in ImmersiveSpace. But we only can use the meter unit in RealityKit. I create a plane entity, I don't know how to set the size using meter unit to make the plane's size totally consistent with the system window. Also, I want to know the z and y position of the system window in the immersive space.

Answered by Vision Pro Engineer in 821164022

Hi @NahtanMak ,

It seems like PhysicalMetric might help you out here.

Also, the Vision Pro places windows at the user's head position, in terms of the y. for the z, you'd likely just have to push it back half a meter. Take a look at this sample: https://developer.apple.com/documentation/visionos/placing-entities-using-head-and-device-transform

It will help with finding the head/device transform to place your entities.

Accepted Answer

Hi @NahtanMak ,

It seems like PhysicalMetric might help you out here.

Also, the Vision Pro places windows at the user's head position, in terms of the y. for the z, you'd likely just have to push it back half a meter. Take a look at this sample: https://developer.apple.com/documentation/visionos/placing-entities-using-head-and-device-transform

It will help with finding the head/device transform to place your entities.

What's the relation of SwiftUI frames' sizes and RealityKit Entities sizes
 
 
Q