The Apple documentation seems to say RealityKit should obey the autoplay metadata, but it doesn't seem to work. Is the problem with my (hand coded) USDA files, the Swift, or something else? Thanks in advance.
I can make the animations run with an explicit call to run, but what have I done wrong to get the one cube to autoplay?
https://github.com/carlynorama/ExploreVisionPro_AnimationTests
import SwiftUI
import RealityKit
import RealityKitContent
struct ContentView: View {
@State var enlarge = false
var body: some View {
VStack {
//A ModelEntity, not expected to autoplay
Model3D(named: "cube_purple_autoplay", bundle: realityKitContentBundle)
//An Entity, actually expected this to autoplay
RealityView { content in
if let cube = try? await Entity(named: "cube_purple_autoplay", in: realityKitContentBundle) {
print(cube.components)
content.add(cube)
}
}
//Scene has one cube that should auto play, one that should not.
//Neither do, but both will start (as expected) with click.
RealityView { content in
// Add the initial RealityKit content
if let scene = try? await Entity(named: "Scene", in: realityKitContentBundle) {
content.add(scene)
}
} update: { content in
// Update the RealityKit content when SwiftUI state changes
if let scene = content.entities.first {
if enlarge {
for animation in scene.availableAnimations {
scene.playAnimation(animation.repeat())
}
} else {
scene.stopAllAnimations()
}
let uniformScale: Float = enlarge ? 1.4 : 1.0
scene.transform.scale = [uniformScale, uniformScale, uniformScale]
}
}
.gesture(TapGesture().targetedToAnyEntity().onEnded { _ in
enlarge.toggle()
})
VStack {
Toggle("Enlarge RealityView Content", isOn: $enlarge)
.toggleStyle(.button)
}.padding().glassBackgroundEffect()
}
}
}
No autospin meta data
#usda 1.0
(
defaultPrim = "transformAnimation"
endTimeCode = 89
startTimeCode = 0
timeCodesPerSecond = 24
upAxis = "Y"
)
def Xform "transformAnimation" ()
{
def Scope "Geom"
{
def Xform "xform1"
{
float xformOp:rotateY.timeSamples = {
...
}
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateY"]
over "cube_1" (
prepend references = @./cube_base_with_purple_linked.usd@
)
{
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}
With autoplay metadata
#usda 1.0
(
defaultPrim = "autoAnimation"
endTimeCode = 89
startTimeCode = 0
timeCodesPerSecond = 24
autoPlay = true
playbackMode = "loop"
upAxis = "Y"
)
def Xform "autoAnimation"
{
def Scope "Geom"
{
def Xform "xform1"
{
float xformOp:rotateY.timeSamples = {
...
}
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateY"]
over "cube_1" (
prepend references = @./cube_base_with_purple_linked.usd@
)
{
quatf xformOp:orient = (1, 0, 0, 0)
float3 xformOp:scale = (2, 2, 2)
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
}
}
}
}
Reality Composer Pro
RSS for tagLeverage the all new Reality Composer Pro, designed to make it easy to preview and prepare 3D content for your visionOS apps
Posts under Reality Composer Pro tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have a blender project, for simplicity a black hole. The way that it is modeled is a sphere on top of a round plane, and then a bunch of effects on that.
I have tried multiple ways:
convert to USD from the file menu
convert to obj and then import
But all of them have resulted in just the body, not any effects.
Does anybody know how to do this properly? I seem to have no clue except for going through the Reality Converter Pro (which I planned on going through already - but modeling it there)
Thread 1: Fatal error: No ObservableObject of type GlobalEnvironment found. A View.environmentObject(_:) for GlobalEnvironment may be missing as an ancestor of this view.
Hello there,
Can you please give me a complete roadmap to become a 𝑽𝒊𝒔𝒊𝒐𝒏𝑶𝑺 developer?
With the latest software upgrades such Sonoma 14.0, Xcode 15.0 Beta 8 and Reality Composer Pro, what is the alternative to behaviours for a web based AR app for iOS 17? Any example, documentation or tutorial about how to use custom components to provide user interactivity such click events and be able to export the scene as USDZ?
Hello,
I am developing a VisionOS based application, that uses the various data providers like Image Tracking, Plane Detection, Scene Reconstruction but these are not supported on VisionOS Simulator. What is the Work Around for this issue ?
I've been using the MacOS XCode Reality Composer to export interactive .reality files that can be hosted on the web and linked to, triggering QuickLook to open the interactive AR experience.
That works really well.
I've just downloaded XCode 15 Beta which ships with the new Reality Composer Pro and I can't see a way to export to .reality files anymore. It seems that this is only for building apps that ship as native iOS etc apps, rather than that can be viewed in QuickLook.
Am I missing something, or is it no longer possible to export .reality files?
Thanks.
Hello,
Currently working on a project that was finished in Reality Composer but then we noticed the pink material after changing scenes on iOS 17 devices.
So did some updating to Mac OS 14 and X Code 15 beta to use Reality Composer Pro and currently stuck on how to setup the animations and onClick triggers to be able play animation from the USDZ model in the scene. Once the animation is finished, it will trigger the next scene.
This was done through behaviors in Reality Composer and it was simple drag and drop. But now it seem we need to do it by components which i don't mind just don't see much resources on how to set this up properly.
Is there are way to do behaviors like in Reality Composer?
Extra: If there is a way to use alpha pngs or be able to drag PNG's into the scene like in Reality Composer?
I have a usdz model with animation that I can preview in RCP. When I create a new base/example visionOS project in Xcode it's set up to load in the 'Scene" and "Immersive" reality kit content. But my models don't play the animation.
How do I fire off the contained animations in those files?
Is there a code snippet that someone can share that takes into account how the example project is setup?
Hi,
I am currently developing a Full Space App. I have a question about how to implement the display of Entity or Model Entity in front of the user. I want to move the Entity or Model Entity to the user's front, not only at the initial display, but also when the user takes an action such as tapping. (Animation is not required.) I want to perform the initial placement process to the user's front when the reset button is tapped.
Thanks.
Sadao Tokuyama
https://twitter.com/tokufxug
https://www.linkedin.com/in/sadao-tokuyama/
https://1planet.co.jp/tech-blog/category/applevisionpro
I'm trying to create a feature in my app vision OS app where i show a reality view and on button click toggle different entities as in showing them on button click and vice versa.
Is this possible in Vision os? if so how can i do this ?
All that I did now was to instanciate my scene which contains a car 3d model, red tyres and blue tyres.
On a button click i'm trying to show the blue tyres instead of the red ones.
Is this possible ?
Thank you,
Does the PBR material setup in RCP support packed RGB channels from a single image?
Does the material graph support splitting the output of RGB values on the image node for custom material setup?
I'm trying to run this demo, which opened a month ago, but now returns 2 issues in xCode: https://developer.apple.com/documentation/visionos/diorama
My goal is to better understand how to use Reality Composer Pro to develop visionOS apps for the Vision Pro.
BillboardSystem.swift:39:58 Value of type 'WorldTrackingProvider' has no member 'queryDeviceAnchor'
Cannot find 'Attachment' in scope. Preview paused shows.
Any thoughts on where I'm off? Thanks!
Light Intro IOS Swift Vision Pro - ZIPZY GAMES
hi
I have made a simple textured planet 3D in Reality Composer Pro, and the question is how can I visualize it in the Vision Pro simulator.
I already have everything installed, even the simulator works fine, but I don't know how to run what I do in RealityComposerPro, export it to vision Simulator.
Any comment will be very appreciated.
thank you.
Hello!
My app supports iOS and visionOS in a single target. But when I preview the app on iOS device/simulator, an error occurred:
The RealityKitContent.rkassets is located in my RealityKitContent package that is linked on visionOS.
It seems that Xcode Preview is ignoring the link settings and attempt to build RealityKitContent.rkassets on iOS.
Reproduce Steps:
Clone my demo project at https://github.com/gongzhang/rkassets-preview-issue-demo
Build the app for iOS (success)
Preview ContentView.swift (failed due to RealityKitContent.rkassets issue)
Hello,
I am looking for something to allow me to Anchor a webview component to the user, as in it follows their line of vision as they move.
I tried using RealityView with an Anchor Entity, but it raises an error of "Presentations are not permitted within volumetric window scene". Can I anchor the Window instead?
Hi. Given an RC entity
var physicsBody = tappedObject.entity.components[PhysicsBodyComponent.self]! as PhysicsBodyComponent
how does one call
func applyImpulse(_ impulse: SIMD3, at position: SIMD3, relativeTo referenceEntity: Entity?)
to impose an impulse on the object? Or the real question is how does one obtain a physiceBody on the Model.Entity?
Thanks!
I have an iOS ARKit app I'm trying to convert to visionOS, but not having luck detecting gestures on my Reality Composer model entities the way I could with ARView. All the documentation I could find on gestures in visionOS seems focused on RealityViews.
So there's a "grounding shadow" component we can add to any entity in Reality Composer Pro.
In case my use case is Apple Vision Pro + Reality Kit:
I'm wondering, by default I think I'd want to add this to any entity that's a ModelEntity in my scene... right?
Should we just add this component once to the root transform?
Or should we add it to any entity individually if it's a model entity?
Or should we not add this at all? Will RealityKit do it for us?
Or does it also depend if we use a volume or a full space?