mapbox/mapbox-vision-ar-ios

How to add custom 3d model annotation?

Opened this issue · 0 comments

I have designed own 3d model marker for destination. Everything goes fine but marker does not shows on destination.
here is my code which i tried :

 func initScene() {
   
    do {
        let arrowMesh = try loadMesh(name: "lane")
        let arrowEntity = AREntity(mesh: arrowMesh)
        arrowEntity.material.diffuseColor = kArrowColor
        arrowEntity.material.specularPower = 100
        arrowEntity.material.specularColor = float3(1, 1, 1) //kArrowColor.xyz
        arrowEntity.material.ambientLightColor = kArrowColor.xyz //float3(0.5, 0.5, 0.5)
        arrowEntity.renderPipeline = renderPipelineArrow
        
        arrowNode.entity = arrowEntity
        arrowNode.position = float3(0, 0, 0)
        
      scene.rootNode.add(child: arrowNode)
        
   
        defaultLight = ARLight(color: float3(1, 1, 1), position: float3(0, 7, 0))
    } catch {
        assertionFailure("error occured \(error.localizedDescription)  ")
    }
    
    //nav-arrow
    do {
        let markerMesh = try loadMesh(name: "3dmarker")
        let markerEntity = AREntity(mesh: markerMesh)
        markerEntity.material.diffuseColor = float4(1, 0, 0, 0.99)
        markerEntity.material.specularPower = 100
        markerEntity.material.specularColor = float3(1, 1, 1) //kArrowColor.xyz
        markerEntity.material.ambientLightColor = kArrowColor.xyz //float3(0.5, 0.5, 0.5)
        markerEntity.renderPipeline = renderPipelineArrow

        markerNode.entity = markerEntity

        markerNode.position = float3(0, 0, 0)

        scene.rootNode.add(child: markerNode)

    }catch {
        assertionFailure("error occured \(error.localizedDescription)  ")
    }

}