It seems it's gone now and since it seems that the only information it needs is the position, I just substituted my code into this :
let anchor = AnchorEntity(anchor: objectAnchor.transform.position)
Seems to be working for now but I'm not sure if that's the actual substitute for init(anchor:)
Let's see what other suprises this new update brings :)
Post
Replies
Boosts
Views
Activity
Thanks, this does solve the issue but I'm not curious what does this line mean, especially the subscript part ?
content: { [bindingValueInt] in
because I know content is ()->Void that doesn't except any parameter
Hi,
I mean if I try to rotate 1.5 pi, I get 90 degree counter clockwise, .pi I get 180 degree rotation clockwise.
I guess it only rotates the difference, so if I try to rotate 4 pi (I assume this will rotate 360 twice) this will not rotate anything as this is basically 0 degree,
Any idea on how to approach rotation in animation that doesn't involve repeating the move method?
Sure, here's the complete code
Sure
var triMat = SimpleMaterial(color: .orange, isMetallic: false)
triMat.color = SimpleMaterial.BaseColor( tint: .white.withAlphaComponent(0.9), texture: MaterialParameters.Texture(try! .load(named: "whity_4x4")))
self.components[ModelComponent.self] = try! ModelComponent(mesh: .generate(from: [meshDesc]), materials: [triMat])
guard let device = MTLCreateSystemDefaultDevice() else {
fatalError("Error creating default metal device.")
}
let library = device.makeDefaultLibrary()!
let geomShader = CustomMaterial.GeometryModifier(named: "billboard", in: library)
let surfaceShader = CustomMaterial.SurfaceShader(named: "scroll", in: library)
var customMaterials:[RealityKit.Material] = []
let materials = self.model?.materials
for material in materials! {
var material = try? CustomMaterial(from: material,
surfaceShader: surfaceShader,
geometryModifier: geomShader)
//these custom values are to define the speed and direction of the scrolling
material?.custom.value[0] = 100
material?.custom.value[1] = 4
material?.custom.value[2] = 4
customMaterials.append(material!)
}
self.model?.materials = customMaterials
Hmm, are you saying that for opacity there should be another texture like normal texture? and we can't get the alpha value from the RGBA texture?