Reality Composer Pro

RSS for tag

Prototype and produce content for AR experiences using Reality Composer Pro.

Learn More

Post

Replies

Boosts

Views

Activity

Physics Body Components within a hierarchy behave weird
Ok, I am loading an object from a Reality Composer Pro scene that has two entities inside its hierarchy that both have a Physics Body and a Collision component like this Root Outer Box Mesh Hinge + physics(static/kinematic) + collision Door. + physics(dynamic) + collision I tried to keep the physics/collision components only to the hinge and the door while I move the root or the outer box via code around. The behaviour I see is that it either moves the hinge and the door around relative to the top level (despite me checking the movement locking) OR starts rotating! the root or outer box even though I only set its position. What is the correct setup in this case? What I want is that I can move the whole object around and settle it somewhere and still have the door pinned at a fixed relative position and have one degree freedom on the hinge axis. I know how to do it in code but I really want to use the build in Reality Composer Pro settings/components. I am using the latest beta 4.
0
0
271
Jul ’24
HoverState in RealityView
In a scenario involving one of the entities in a Reality Composer Pro environment, I intend for this entity to display a blue material when viewed by the user. To achieve this, I have added the following Shader Graphs to the materials associated with this entity: Additionally, I have included the HoverEffectComponent component to the Reality View in the code: RealityView { content in if let model = try? await Entity(named: “WorldScene”, in: realityKitContentBundle) { let hoverEffect = HoverEffectComponent(.shader(.default)) model.components.set(hoverEffect) content.add(model) } } However, hover this entity, I am unable to observe any visual reaction. Could you please provide guidance on how to resolve this issue?
1
0
427
Aug ’24
Static property 'shared' is not concurrency-safe because it is non-isolated global shared mutable state
Hi all, I am fairly new to Swift development so go easy on me! I am working through a few examples of using Reality Kit content within my projects and whilst trying to work on adding gestures to RealityKit entities, I have come across a weird issue. Downloading and running the example here This works fine for me. When adding the same things to my own code - in this case a class called EntityGestureState to my GestureComponent file (within the reality kit project) I constantly get this error: "Static property 'shared' is not concurrency-safe because it is non-isolated global shared mutable state" Even just troubleshooting with something as simple as: public class EntityGestureState { // The entity currently being dragged if a gesture is in progress. // Singleton shared instance static let shared: EntityGestureState = EntityGestureState() } I immediately get the error and from a bunch of trial and error and reading different sources I can't seem to get around this. Could anyone help here? I am running on Xcode 16 beta 3 so am wondering if it's a bug but also more than likely user-error.
2
1
1.1k
Aug ’24
It cannot be looped after enlarging the window.
I have developed a code that initiates the Timeline in the Reality Composer Pro scene every 12.93 seconds. RealityView { … } .onAppear { startTimer() } .onDisappear { stopTimer() } func startTimer() { timer = Timer.scheduledTimer(withTimeInterval: 12.93, repeats: true) { _ in action() } } func stopTimer() { timer?.invalidate() } func action() { print(“SunUpDown”) NotificationCenter.default.post( name: NSNotification.Name(“RealityKit.NotificationTrigger”), object: nil, userInfo: [ “RealityKit.NotificationTrigger.Scene”: scene as Any, “RealityKit.NotificationTrigger.Identifier”: “SunUpDown” ] ) } Upon receiving the “SunUpDown” command, Timeline will be executed. However, everything was functioning normally when I was running the scene, and I could continue looping until I attempted to zoom in on the window and discovered that it ceased looping. Could you please provide an explanation for this behavior? Note: The window type is volumetric, and the parameter of the defaultWorldScaling modifier is dynamic.
1
0
389
Aug ’24
Is it true that without code, Reality Composer Pro cannot make a vertical door that swings with gravity?
I tested all variations. The checkboxes in Reality Composer Pro 2 (beta 4) in the Physics Body component: are absolute and not parent-relative. Also, regardless of what I set the center of mass to: it always rotates around the center of mass despite the local rotation being correctly at the center of origin (imported from Blender). Thus I can get the door to turn but never to swing because it always rotates around its center of mass. Tell me if this is expected behaviour or if there is a simple way to make this work.
8
0
640
Aug ’24
RealityKit ShaderGraphMaterial parameters in Reality Composer Pro
I have a custom material using Shader Graph in Reality Composer Pro, and I am trying to rig up sliders to values to control the shader. I am able to read the values from the Shader Graph without a problem, and I can even update them when setting them from the LLDB command line and then getting the values back. But the changes are not reflected in the graphics. Is there some sort of update() method or something that is required to read the changed parameter values? On a related note, I am trying to understand what the MaterialParameters.Handle property is and why one would access a MaterialParameter via the handle vs just the name.
1
0
445
Aug ’24
Recording Issues in Unity Game with Reality Composer Pro - Black Screen
I’m encountering an issue with recording in my Unity game through Reality Composer Pro. When I attempt to record video or take screenshots, it results in a black screen once my game launches. Screenshots and videos outside my game record fine, but within the game, the recordings are just black. Additionally, when using my headset, the display is distorted and only my right eye shows anything, while the left eye remains black. Here are some specifics: My game is developed in Unity. I’m using all the betas: Xcode 16 beta, the new macOS beta, and VisionOS 2 beta. In the attached screenshot, you can see an Apple UI overlay with a black screen behind it. However, when I’m in the headset, I actually see my game along with that UI overlay, so it seems like the game itself isn’t getting recorded. Also, I noticed on the Apple webpage that they recommend using the Developer Capture feature in Reality Composer Pro for high-quality screenshots and app previews. However, I find that using Control Center for recording works pretty well despite the lower quality and foveated resolution. If I can’t get Reality Composer Pro to capture in 4K, is it still acceptable to use screenshots and record videos from the Control Center? Has anyone encountered similar issues or have any insights on what might be causing this? And regarding the secondary question, I’d appreciate any guidance from Apple on the acceptability of using Control Center recordings as a fallback. Here's a video preview I made with Control Center recordings. Is this quality acceptable? https://youtu.be/z4VIO7obNNg?si=2irqHEfeGjkNBUvb
0
0
353
Aug ’24
VisionOS AvPlayer issue
I wanted to report an issue I've encountered with the latest Beta 6 update concerning the immersive space feature. Before this update, when I was in immersive space and clicked on a window button to play a video using AVPlayer, I had the option to keep other windows open and accessible within the environment. Could you please investigate this issue? It would be helpful to know if this is an intentional change or if there might be a bug affecting window management in immersive space. Thank you for your attention to this matter. I look forward to your response.
3
1
477
Aug ’24
Update World Anchor using object anchor
Hi. I display buildings in mixed immersive view. Right now the building appears in relation to the person when the view is opened. (world anchor) To position the building precisely, I want to use object tracking. Set up a project following the wwdc object tracking session. That works well sort of... With an object anchor, the 3D object related to the anchor disappears as soon as the Tracked object is out of view, and with the big objects you don't get the chance to look around. I figure I need to give my 3D object a world anchor, and only have that world anchor update if a change in the object anchor is detected. how do I do that? Preferable using the tools in Reality Composer pro (or very well explained, as I am new to code)
4
0
402
Aug ’24
Drag Gesture on Entity with PhysicsBodyComponent is not behaving properly (glitching)
Hi everyone, I'm new to Swift and VisionOS development in general, so please go easy on me. Currently, I'm looking at a sample project from a WWDC23 session that uses RealityKit and ARKit to add a cube entity to a scene via tap gesture. The link to the sample project is here. Instead of adding a cube, I changed the code to adding a usdz model instead. Here is my code: func add3DModel(tapLocation: SIMD3<Float>) { let placementLocation = tapLocation + SIMD3<Float>(0, 0.1, 0) guard let entity = try? Entity.load(named: "cake-usdz", in: realityKitContentBundle) else { logger.error("failed to load 3D model") return } // calculate the collision box (the boundaries) let entitySize = entity.visualBounds(relativeTo: nil) let width = entitySize.max.x - entitySize.min.x let height = entitySize.max.y - entitySize.min.y let depth = entitySize.max.z - entitySize.min.z // logger.debug("width: \(width), height: \(height), depth: \(depth)") // set collision shape let collisionShape = ShapeResource.generateBox(size: SIMD3<Float>(width, height, depth)) entity.components.set(CollisionComponent(shapes: [collisionShape])) // set the position and input types to indirect entity.setPosition(placementLocation, relativeTo: nil) entity.components.set(InputTargetComponent(allowedInputTypes: .indirect)) let material = PhysicsMaterialResource.generate(friction: 0.8, restitution: 0.0) entity.components.set(PhysicsBodyComponent( shapes: [collisionShape], mass: 1.0, material: material, mode: .dynamic )) contentEntity.addChild(entity) } This works fine so far. But when I tried to add a Drag Gesture to drag the added entity around. There are weird glitches happening with the model. The model jumped up and down, and even rotating around it self sometimes. Below is my code for Drag Gesture. I placed it directly below the code for Spatial Tap Gesture in the sample project. .gesture(DragGesture().targetedToAnyEntity().onChanged({ value in let targetedEntity = value.entity targetedEntity.position = value.convert(value.location3D, from: .local, to: .scene) })) At first, I thought my code was wrong. But after looking around and removing the PhysicsBodyComponent for the added model, the entity was moving as intended while dragging. I can't figure out a solution to this. Could anyone help me? I'm currently on Xcode 16 beta 2, and visionOS 2.0. Because I'm on Beta, I'm unsure if this is a bug or if I just missed something. Thank you.
1
0
350
Aug ’24
Can't Tap
I am attempting to execute actions after clicking an entity in Reality View using the Behaviors component. I have added the Input Target component and the Tap gesture as follows: TapGesture().targetedToAnyEntity() .onEnded({ value in _ = value.entity.applyTapForBehaviors() }) ) However, during testing, I have observed that the entity does not appear to recognize the click gesture. Could you kindly provide any relevant documentation or guidance on this matter?
1
1
370
Aug ’24
Hand Anchor Error
The entity in My RealityView contains tracking components and allows them to track different places of the hand. However, I found that except for the fingertip of the index finger, the fingertip of the thumb, the palm and the wrist, all other positions cannot be tracked normally (such as the fingertip of the middle finger). How can I solve it (I think it may be a beta version of the bug)
1
0
345
Aug ’24
How to trigger actions by OnCollision in Behaviors Component
It's all about notifications to trigger actions from RCP's new Timeline system. From Compose interactive 3D content in Reality Composer Pro I am actually starting to confuse why there was need to use Entity.applyTapForBehaviors in code to trigger content in Behaviors Component. Simply because in Behaviors Component, we have chosen OnTap to allow a "Tap Notification" to trigger our action (on a selected target object). Then I guess by selecting OnCollision this trigger, I should write something like CollisionEvent.entityA.applyCollisionForBehaviors, which we don't have. And ofc the collision on my object won't trigger this action (because I only did things in RCP not in code). Ignoring this post has pointed out we could use Behaviors Component's OnNotification to trigger something for now. I found that I could still use OnTap trigger but actually put my code Entity.applyTapForBehaviors under my subscribed collision's begin event. That actually works better than OnCollision So what is the design principles here? And how could I trigger a collision notification to let my Behaviors Component's OnCollision actually works?
0
0
320
Aug ’24
The notification is invalid
I can execute an action by allowing Xcode to send a notification to Reality Composer Pro via NotificationCenter, or I can send notifications to Xcode through the Notification Action in Reality Composer Pro. However, I discovered that they were unable to accept notifications from both parties within my project. To ascertain whether there was an error in my code, I created a simple Demo project. I utilized the same code and determined that it functioned normally within the Demo project. It is perplexing that I am unable to resolve this issue. Do I require additional modifications?
1
0
370
Aug ’24
Entity.applyTapForBehaviors() only works on Simulator, not device
I created a simple Timeline animation with only a "Play Audio" action in RCP. Also a Behaviors Component setting an "OnTap" trigger to fire this Timeline animation. In my code, I simply run Entity.applyTapForBehaviors() when something happened. The audio can be normally played on the simulator but cannot be played on the device. Any potential bug leads this behavior? Env below: Simulator Version: visionOS 2.0 (22N5286g) XCode Version: Version 16.0 beta 4 (16A5211f) Device Version: visionOS 2.0 beta (latest)
1
0
393
Aug ’24