Add a modifier to a single model in the Reality Composer Pro scene

We can add many models in the Reality Composer Pro scene, but when I use RealityView to display and add modifiers in SwiftUI, the modifiers will have Effect, and I don't want to do this. I hope this modifier will be valid for a single model in the Reality Composer Pro scenario.

May I ask how to add modifiers to a single model in the Reality Composer Pro scene?

Answered by Vision Pro Engineer in 793926022

If by model you mean RealityKit Entity, there are no equivalent modifiers. If your goal is to position 3D models relative to one another (like in an HStack) in a SwiftUI view consider using Model3D which is a view capable of display 3D models and supports the modifiers you mentioned.

As an aside you can use visualBounds(recursive:relativeTo:excludeInactive:) to get the position and size of an entity which is useful for positioning neighboring content around it.

Can you provide more details on your use case? Which modifier do you want to do this with? Some modifiers take arguments that enable you target a specific entity or specific entities. For example you can use targetedToEntity(_:) or targetedToEntity(where:) to target a gesture to a specific entity.

Accepted Answer

If by model you mean RealityKit Entity, there are no equivalent modifiers. If your goal is to position 3D models relative to one another (like in an HStack) in a SwiftUI view consider using Model3D which is a view capable of display 3D models and supports the modifiers you mentioned.

As an aside you can use visualBounds(recursive:relativeTo:excludeInactive:) to get the position and size of an entity which is useful for positioning neighboring content around it.

Add a modifier to a single model in the Reality Composer Pro scene
 
 
Q