As VisionOS is not yet a "Released" OS, it is not available in the non-beta versions of Xcode. Like the other poster said, you need to open up a beta version like the release notes say.
Post
Replies
Boosts
Views
Activity
Correct. You can place your own plane, give it a collision shape, and use that to test for the time being.
One more:
What if the user is holding something for away and they rotate their torso away from it?
Will it follow along or stay static?
Yeah, it felt really misleading, but Apple's developer communication is usually about this bad.
It will compile, but I believe it won't fire so we can't track user's eyes.
Number one is prevented for privacy reasons. There are some ways to communicate to the system which shape should be used when a hover is occurring, but there is no way to act on the event.
The Hover highlighting is even performed out-of-process so it can't be used maliciously, such as my ad-companies.
Number Two I don't know
Number three may be called "Billboarding" and there is an example of that in the splash splash sample code.
Drag gestures can be targeted to any entity via .targetedToAnyEntity() or a specific one with .targetedToEntity
If you use "any entity", you can check the entities identifiers and components inside your drag processing closure.
I notice that once I open a second ModelContainer on same URL as the document that's open in the DocumentGroup, then all saves to the DocumentGroup's model container fail with:
Error saving the database Error Domain=NSCocoaErrorDomain Code=134020 "The model configuration used to open the store is incompatible with the one that was used to create the store." UserInfo={NSAffectedObjectsErrorKey=<NSManagedObject: 0x6000021b97c0> (entity: Blah; id: 0x60000026e0c0 <x-coredata:///Blah/tAC19CF5F-052B-4CF6-B7CD-EDA188FC54BE13>; data: {
id = "91E56F61-CFE0-42E4-9EA9-EAD4256B64AB";
imageData = nil;
name = "Untitled Blah";
})}
I will assume that this is just not a good idea right now, and conclude that Document based SwiftData apps do not work well with multiple scenes.
Most of the data providers give you some mesh information that you then need to place into an entity as a collision component.
If you’re trying to get planes or world meshes to test interactions with, you may try adding those entities yourself instead of going through the ARKit providers.
I did this with some Planes so I could test plane interactions like placing things on walls.
I encourage anyone from Apple to file the report. I don't see the reports I file having much impact.
Why’s your use case? “Hover” on visionOS is what the user’s gaze is on, and since our eyes move
so much, it may not be feel right to key behavior on it.
Curious what you had in mind.
I noticed the other day on Xcode 15.1.0b2 if you create a new VisionOS app project with a progressive immersive scene, it includes code with a light box example.
Alright. Good riddance. This worked for me:
NOTE: There's a BIT of oddness with raycasting to a tap gesture's location. Sometimes it fails, which is confusing to me given the tap succeeded. Maybe I'm not converting the locations correctly? Maybe it works better on device?
In a tap gesture handler, get the tap location on a collision shape with:
let worldPosition: SIMD3<Float> = value.convert(value.location3D, from: .local, to: .scene)
With a running WorldTrackingProvider you can get the current device pose with
worldTracking.queryDeviceAnchor(atTimestamp: CACurrentMediaTime())
Then process it like so to get it world-space:
let transform = Transform(matrix: pose.originFromAnchorTransform)
let locationOfDevice = transform.translation
You can then do a raycast to a tap location in world-coordinate-space like so:
let raycastResult = scene.raycast(from: locationOfDevice, to: worldPosition)
If successful, an entry in the raycast result will have normal information. Here I grab the first one
guard let result = raycastResult.first else {
print("NO RAYCAST HITS?????")
}
let normal = result.normal
Make a quaternion to rotate from identity to the normal vector's angle:
// Calculate the rotation quaternion to align the forward axis with the normal vector
let rotation = simd_quatf(from: SIMD3<Float>(0, 1, 0), to: normal)
Apply it to an entity:
cylinder.transform.rotation = rotation
Hello,
this is a forum for software developers to learn and share information. Please use https://www.apple.com/feedback/ to provide product feedback to Apple.
Yes.
See https://developer.apple.com/documentation/groupactivities for more information. There are also spatial-specific considerations. See the WWDC presentations for that and see https://developer.apple.com/documentation/groupactivities/systemcoordinator for more info.