Open
Description
Hello 👋🏻
I am trying to build a sort of circle arc, or torus section, using the provided line and tube methods. Here is my sample code:
func points(of radius: Float, from start: Angle2D, to end: Angle2D) -> [SIMD3<Float>] {
let degrees = Int(abs(start.degrees - end.degrees))
var points = [SIMD3<Float>]()
for i in 0...degrees {
let angle = Angle2D(degrees: Double(i)).radians
let x = Float(radius * cos(angle))
let y = Float(radius * sin(angle))
points.append([x, 0, y])
}
return points
}
let points = points(of: radius, from: .zero, to: .radians(.pi / 2))
guard let mesh = try? RealityGeometry.line(points: points, radius: 1).0 else { return nil }
let entity = ModelEntity(mesh: mesh, materials: [PhysicallyBasedMaterial.glassMaterial])
The code runs with no errors and manages to go over the guard line. However, using line or generateTube does not produce any visible entity. Interesting fact: using generatePath with the same points does produce the correct mesh, but path is flat and I need a proper 3D tube-like object.
BTW thank you for this package, it's helping me a lot with my non-existent 3D development skills.
Metadata
Metadata
Assignees
Labels
No labels