Post

Replies

Boosts

Views

Activity

Reply to Forward and reverse animations with RealityKit on Vision Pro
Nice! Getting closer - however now my animation does not start paused when it is loaded, and the animation.speed toggle stops working if I allow the animation to play all the way through. Am I instantiating the AnimationPlaybackController class correctly? import RealityKit import RealityKitContent struct ModelView: View { var isPlaying: Bool @State private var scene: Entity? = nil @State private var animationController: AnimationPlaybackController? = nil @State private var playerDefinition: AnimationDefinition? @State private var playerResource: 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!) playerDefinition = scene?.availableAnimations[0].definition playerDefinition?.repeatMode = .none playerResource = try! AnimationResource.generate(with: playerDefinition!) animationController = scene!.playAnimation(playerResource!, startsPaused: true) } .installGestures() .onChange(of: isPlaying) { animationController?.speed = isPlaying ? -1.0 : 1.0 } } }
Topic: Spatial Computing SubTopic: General Tags:
Sep ’24
Reply to Forward and reverse animations with RealityKit on Vision Pro
Nice! Getting closer - however now my animation does not start paused when it is loaded, and the animation.speed toggle stops working if I allow the animation to play all the way through. Am I instantiating the AnimationPlaybackController class correctly? import RealityKit import RealityKitContent struct ModelView: View { var isPlaying: Bool @State private var scene: Entity? = nil @State private var animationController: AnimationPlaybackController? = nil @State private var playerDefinition: AnimationDefinition? @State private var playerResource: 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!) playerDefinition = scene?.availableAnimations[0].definition playerDefinition?.repeatMode = .none playerResource = try! AnimationResource.generate(with: playerDefinition!) animationController = scene!.playAnimation(playerResource!, startsPaused: true) } .installGestures() .onChange(of: isPlaying) { animationController?.speed = isPlaying ? -1.0 : 1.0 } } }
Topic: Spatial Computing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Loading .usdz materials in Reality Composer Pro
Hello! Sorry for the late response - Here is a repo with the usdz file This file was exported from Blender 4.0 Alpha USD branch with the default export settings for materials.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Reality Composer Pro | UnlitSurface and opacity maps error
Do you have an example of adding a component to a ModelSortGroup and then setting the order? something like: let myGroup = ModelSortGroup(depthPass: ModelSortGroup.DepthPass.postPass) let mySort = ModelSortGroupComponent(group: myGroup, order: 2) How do I setup the group to let the sort order know what components to reference when I set the order?
Replies
Boosts
Views
Activity
Nov ’23