Post

Replies

Boosts

Views

Created

Entity not returning to original position
Hello, I am making a RealityKit app where a ball goes and hits some stones, and then goes back to its original position. However, in moving back the ball always tilts a little and sometimes even goes backwards or in other directions! I add my entities in these lines of code: stoneEntity!.scale = [5, 5, 5] anchor.addChild(stoneEntity!) stoneEntity!.transform.translation = SIMD3<Float>(anchor.position.x, anchor.position.y, anchor.position.z) stoneX = stoneEntity!.position.x stoneY = stoneEntity!.position.y stoneZ = stoneEntity!.position.z stoneEntity?.generateCollisionShapes(recursive: true) // Add ball entity anchor.addChild(ballEntity) ballEntity.transform.translation = SIMD3<Float>(anchor.position.x, anchor.position.y, anchor.position.z + 1) ballEntity.generateCollisionShapes(recursive: true) ballEntity.physicsBody = PhysicsBodyComponent(massProperties: PhysicsMassProperties.default, material: PhysicsMaterialResource.default, mode: .kinematic) ballEntity.collision = CollisionComponent(shapes: [.generateSphere(radius: 0.1)], mode: .default, filter: .default) ballEntity.physicsBody?.isTranslationLocked = (true, true, false) view.scene.addAnchor(anchor) And move my ball back in the code: ballEntity.transform.translation = SIMD3<Float>(0, 0, 1) If anyone has any ideas please could you let me know ASAP? Thank you!
1
0
893
Feb ’24
SwiftUI Background Color not Working
Hi. I am making an app with a background image, but that does not take up the full screen on Pro Max iPhones, so I am setting a background color behind the image. Surprisingly, the background color is not showing up. Here is the code of the View: struct IntroView: View {     @StateObject var viewRouter: ViewRouter     var body: some View {         ZStack {             Color("AccentColor").edgesIgnoringSafeArea(.all)             Image("GameStart")             VStack {                 Text(""" The NS Labs app is a placeholder to not show confidential app name """                 ).font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 250).foregroundColor(Color(.systemBlue)) Text(""" Welcome to the NS Labs App """ ).font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 200).foregroundColor(Color(.systemBlue))                 Text("Click Let’s Go to start using the NS Labs app!").font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 200).foregroundColor(Color(.systemYellow)).padding(.bottom, 20)                 Button(action: {                     viewRouter.currentPage = .page2                 }) {                     Text("Let's Go!").foregroundColor(.white).font(.system(size: 34)) }.frame(width: 200, height: 70).background(Color.yellow).cornerRadius(12)             }         } } }
1
0
1.7k
Oct ’21
Entity not returning to original position
Hello, I am making a RealityKit app where a ball goes and hits some stones, and then goes back to its original position. However, in moving back the ball always tilts a little and sometimes even goes backwards or in other directions! I add my entities in these lines of code: stoneEntity!.scale = [5, 5, 5] anchor.addChild(stoneEntity!) stoneEntity!.transform.translation = SIMD3<Float>(anchor.position.x, anchor.position.y, anchor.position.z) stoneX = stoneEntity!.position.x stoneY = stoneEntity!.position.y stoneZ = stoneEntity!.position.z stoneEntity?.generateCollisionShapes(recursive: true) // Add ball entity anchor.addChild(ballEntity) ballEntity.transform.translation = SIMD3<Float>(anchor.position.x, anchor.position.y, anchor.position.z + 1) ballEntity.generateCollisionShapes(recursive: true) ballEntity.physicsBody = PhysicsBodyComponent(massProperties: PhysicsMassProperties.default, material: PhysicsMaterialResource.default, mode: .kinematic) ballEntity.collision = CollisionComponent(shapes: [.generateSphere(radius: 0.1)], mode: .default, filter: .default) ballEntity.physicsBody?.isTranslationLocked = (true, true, false) view.scene.addAnchor(anchor) And move my ball back in the code: ballEntity.transform.translation = SIMD3<Float>(0, 0, 1) If anyone has any ideas please could you let me know ASAP? Thank you!
Replies
1
Boosts
0
Views
893
Activity
Feb ’24
Install iPadOS beta without 13GB free space
Hello, When I try to install the iPadOS 17 public beta, my 32GB iPad says that it needs 13GB free to install the update! Is there a way to update to the beta without freeing up so much space? This is my main iPad so I don't want to reset it, but can I do it using Finder etc? Bye!
Replies
0
Boosts
0
Views
729
Activity
Jul ’23
Parse App Clip URL
Hi! I am trying to make an App Clip that changes text based on a URL. For example, I have a URL example.com/red?itemName=car. I would like the App Clip's text to say "You have a red car" How can I do this?
Replies
0
Boosts
0
Views
801
Activity
Oct ’21
SwiftUI Background Color not Working
Hi. I am making an app with a background image, but that does not take up the full screen on Pro Max iPhones, so I am setting a background color behind the image. Surprisingly, the background color is not showing up. Here is the code of the View: struct IntroView: View {     @StateObject var viewRouter: ViewRouter     var body: some View {         ZStack {             Color("AccentColor").edgesIgnoringSafeArea(.all)             Image("GameStart")             VStack {                 Text(""" The NS Labs app is a placeholder to not show confidential app name """                 ).font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 250).foregroundColor(Color(.systemBlue)) Text(""" Welcome to the NS Labs App """ ).font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 200).foregroundColor(Color(.systemBlue))                 Text("Click Let’s Go to start using the NS Labs app!").font(.system(size: 20)).frame(width: UIScreen.screenWidth, height: 200).foregroundColor(Color(.systemYellow)).padding(.bottom, 20)                 Button(action: {                     viewRouter.currentPage = .page2                 }) {                     Text("Let's Go!").foregroundColor(.white).font(.system(size: 34)) }.frame(width: 200, height: 70).background(Color.yellow).cornerRadius(12)             }         } } }
Replies
1
Boosts
0
Views
1.7k
Activity
Oct ’21