Post

Replies

Boosts

Views

Activity

Reply to RealityKit Shaders
Since iOS 15 / macOS 12 we can now add shaders in RealityKit 🎉 The entry point for these is GeometryModifier and SurfaceShader. The usage of these is used in the Underwater code sample: Building an Immersive Experience with RealityKit
Jun ’21
Reply to RealityKit Transform rotation: choosing clockwise vs. anti-clockwise
In RealityKit the animation will always take the shortest path to get to the correct transform. This means that rotations will take the shortest distance. If you want to force the animation to go the other way around you'll have to add two animations in sequence: the first one goes half way round the anticlockwise direction, and the second is the final transform of your entity. This also means that you can't spin around an axis object continually without doing something similar - which is very annoying!!
Apr ’21
Reply to SynchronizationServices over the Internet?
Not with the builtin MultipeerConnectivityService, but you can always encode your own data to then send over a TCP connection to another device. The collaboration data can be grabbed with session(_:didOutputCollaborationData:) - https://developer.apple.com/documentation/arkit/arsessionobserver/3152999-session then sent over your network instead. I think if you go to any further detail then you'll need to create your own data structure for sending instructions between devices, which is certainly achievable.
Mar ’21
Reply to position of SCN Objects - beginner's question
I would guess that the labelNode has a parent with a scale of [0.01, 0.01, 0.01]. Scale (as well as position and rotation) is inherited from the node's parent, so if a parent node has a very small scale, then even if the parent scale is increased again, the position will be multiplied by the parent's scale. There are some methods in SceneKit to help with the maths involved in these operations such as this one: https://developer.apple.com/documentation/scenekit/scnnode/1408018-convertposition And you can set the worldPosition of a node too https://developer.apple.com/documentation/scenekit/scnnode/2867405-worldposition
Dec ’20
Reply to AVCaptureSession in RealityKit
You can get the CVPixelBuffer from arView.session.currentFrame?.capturedImage, which comes without any Entities shown. From there you can convert to whatever format you like, Google something like "CVPixelBuffer to UIImage/CGImage/etc." if let capImg = self.arView.session.currentFrame?.capturedImage {     let ciimg = CIImage(cvPixelBuffer: capImg)     let myImage = UIImage(ciImage: ciimg)     // save image or whatever } Not accounting for rotation in my given example, there's examples of how to do that with a quick search.
Dec ’20
Reply to RealityKit Bug?: Setting alpha of a plane's mesh material completely removes the plane/makes it invisible
I just tried a similar bit of code out with the same color settings, but didn't have any issues: let tanchor = AnchorEntity(world: [0, -1, -1]) var simpMat = SimpleMaterial() simpMat.baseColor = MaterialColorParameter.color(.init(red: 0.0, green: 1.0, blue: 1.0, alpha: 0.5)) let tcube = ModelEntity(     mesh: .generatePlane(width: 0.3, depth: 0.3),     materials: [simpMat] ) tanchor.addChild(tcube) self.arView.scene.addAnchor(tanchor) (not anchored to a wall though in this example) Maybe try using a cube with a very small height, or another shape and see if you get the same issue?
Dec ’20
Reply to Drawing dynamic primitives in RealityKit
If you want an actual cylinder the .generateBox with cornerRadius method might not be the best option, as it will give you a capsule shape. Seeing as RealityKit doesn’t let you generate a Cylinder normally I’ve had to be a little creative when doing this; the best method I’ve found, albeit dirty, is using generateText() - https://developer.apple.com/documentation/realitykit/meshresource/3244422-generatetext. The steps are: Add mesh using .generateText(“.”) to a ModelEntity use visualBounds - https://developer.apple.com/documentation/realitykit/modelentity/3244530-visualbounds method to check what dimensions it has given the cylinder using the visual bounds .extents - https://developer.apple.com/documentation/realitykit/boundingbox/3243661-extents change the scale of the ModelEntity to match [1, 1, 1] set the position of ModelEntity to negative .center - https://developer.apple.com/documentation/realitykit/boundingbox/3243656-center make this ModelEntity the child of another Entity (just to simplify scale and rotations) Then you’ll have a cylinder along the Z axis with dimensions the same as the Entity. However you cannot specify the number of segments or the level of detail using generateText(), like you can with SCNCylinder.
Jul ’20
Reply to Detect VPN / Personal Hotspot
@Maci Yes it finally got through, I was basically displaying a small toast message, warning that using a VPN may interfere with MultipeerConnectivity interfaces when I noticed it was switched on, and then the reviewer approved. No confirmation that this was indeed the fix, but I can assume it was. I left warning messages rather than just leaving a blanket stop because some site-access VPNs are okay, it's only specific site-to-site VPNs that divert all network communications, and I do not know how to tell the differences between them.
Jul ’20
Reply to Detect VPN / Personal Hotspot
This is essentially the same as I use in my app. Although the keys could be slightly different, for example "tun0", "tun1" etc. So instead of exact matches my if statement looks like this: if key.contains("tap") OR key.contains("tun") OR key.contains("ppp") OR key.contains("ipsec") {   return true } (replace OR with ||, seems that the code formatting on the forums likes to replace them with underscores?)
Jun ’20