GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

VisionOS ModelEntity placement issue

Forums > visionOS

I am glad to see a new VisionOS forum! Back in Feb, I had posted a question about blending colors over the faces of a programmatically defined tetrahedron with RealityKit shaders, and eventually, with the help of Apple support, provide an answer in the SwiftUI forum. I'm still banging away with tetrahedra, and now want to generate very many tetrahedra (millions). I thought this part would be easy, if I could get one done correctly! However, I'm finding that with just 2 tetrahedra, even though the vertices have them as being adjacent, they are offset vertically.
I am calling a TetView struct within a ForEach loop for each of the tetrahedra. So the issue seems to be that RealityKit is interpreting each instance of a TetView as distinct and adjusting it's position within the view. I'm looking for general guidance, without knowing where to start: do I need to construct a scene outside of the TetView, or a scene (instead of just individual ModelEntities within TetView? Something simple such as being able to declare no offset? Thanks, in advance, for your suggestions.

   

Hacking with Swift is sponsored by Alex.

SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!

Try for free!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.