Reacting to hover on a RealityKit Entity

I have some entities which use attachments to show a label next to them. I would like to change this to only show the label when the entity is being looked at / hovered over. I have the new HoverEffect component on my entity that works nicely, but I can't see how I toggle the visibility of the labels.

Answered by Vision Pro Engineer in 794470022

Hi @kemalenver ,

You can't toggle the visibility of the attachment when you're looking at an Entity. You can toggle the visibility of SwiftUI views with .hoverEffect, but since this is an Entity with an attachment, you'd only be able to add the custom hover effect to the attachment (if it's a SwiftUI view).

Please do file an enhancement report at https://feedbackassistant.apple.com and post the FB number here.

Accepted Answer

Hi @kemalenver ,

You can't toggle the visibility of the attachment when you're looking at an Entity. You can toggle the visibility of SwiftUI views with .hoverEffect, but since this is an Entity with an attachment, you'd only be able to add the custom hover effect to the attachment (if it's a SwiftUI view).

Please do file an enhancement report at https://feedbackassistant.apple.com and post the FB number here.

Hi thanks for your reply. I've created an enhancement request FB14241109 'Create developer hooks to respond to hovering over Entities'.

It might be a bit late in the day, but it would be great to have this for the release of visionOS 2. I have a bunch of use cases in various apps that would be better with this functionality.

Reacting to hover on a RealityKit Entity
 
 
Q