Post

Replies

Boosts

Views

Activity

Forward and reverse animations with RealityKit on Vision Pro
Hello! I'm trying to play an animation with a toggle button. When the button is toggled the animation either plays forward from the first frame (.speed = 1) OR plays backward from the last frame (.speed = -1), so if the button is toggled when the animation is only halfway through, it 'jumps' to the first or last frame. The animation is 120 frames, and I want the position in playback to be preserved when the button is toggled - so the animation reverses or continues forward from whatever frame the animation was currently on. Any tips on implementation? Thanks! import RealityKit import RealityKitContent struct ModelView: View { var isPlaying: Bool @State private var scene: Entity? = nil @State private var unboxAnimationResource: AnimationResource? = nil var body: some View { RealityView { content in // Specify the name of the Entity you want scene = try? await Entity(named: "TestAsset", in: realityKitContentBundle) scene!.generateCollisionShapes(recursive: true) scene!.components.set(InputTargetComponent()) content.add(scene!) } .installGestures() .onChange(of: isPlaying) { if (isPlaying){ var playerDefinition = scene!.availableAnimations[0].definition playerDefinition.speed = 1 playerDefinition.repeatMode = .none playerDefinition.trimDuration = 0 let playerAnimation = try! AnimationResource.generate(with: playerDefinition) scene!.playAnimation(playerAnimation) } else { var playerDefinition = scene!.availableAnimations[0].definition playerDefinition.speed = -1 playerDefinition.repeatMode = .none playerDefinition.trimDuration = 0 let playerAnimation = try! AnimationResource.generate(with: playerDefinition) scene!.playAnimation(playerAnimation) } } } } Thanks!
2
0
458
Sep ’24
Timeline Animation in Reality Composer Pro
I'm using Reality Composer Pro Version 2.0 Version 2.0 (448.0.10.0.2) avaliable in Xcode_16_beta_4 When adding a animation from the Animation Library component on my armature to a timeline - the animation does not 'freeze' on the last frame. Is there a way to 'freeze' the first or last frames when adding animations to the timeline? And how should I expect the first and last keys on my animations to behave with the default 'rest pose' on the imported usd file?
1
0
602
Jul ’24
Animated USD file | Starting position of the USD is not the same as first frame of animation
Hello all, I am building for visionOS with another engineer and using Reality Composer Pro to validate usd files. The starting position of my animated usdz, its position when it's first loaded, is not the same as the first frame of the animation on the usdz file For testing, I am using the AR Quick Look asset 'toy_biplane_idle.usdz' which demonstrates the same 'error' we're currently getting with our own usdz files. When the usdz is loaded, it is on the ground plane - But when the aniamtion is played, the plane 'snaps' to the position of the first frame of the animation - This 'snapping' behavior is giving us problems. We want the user ot see this plane in its static 'load' position with the option to play the animation. But we dont want it to snap when the user presses play Is it possible to load the .usdz in the position specified by the first frame of the animation? What is the best way to fix this issue. Thanks!
1
0
626
Jan ’24
Loading .usdz materials in Reality Composer Pro
Hello All - I'm receiving .usdz files from a client. When previewing the .usdz file in Reality Converter - the materials show up as expected. But when I load the .usdz in Reality Composer Pro, all the materials show up as grey. I've attached an image of the errors I'm get inside Reality Converter, to help trouble shoot. What steps can I take to get these materials working in my Reality Composer Pro project? Thanks!
2
0
750
Jan ’24
Reality Composer Pro | UnlitSurface and opacity maps error
Hello all - I'm experiencing a shading error when I have two UnlitSurface shaders using images for color and opacity. When the shaders are applied to two mesh planes, one placed in front of the other, the shader in front will render and the plane mesh will mask out and not render what is behind. Basically - it looks like the opacity map on the shader in front is creating a 'mask'. I've attached some images here to help explain. Has anyone experienced this error? And how can I go about fixing this - thx!
5
2
1.4k
Nov ’23