Closed FlutterEngineer closed 3 years ago
Hi,
The problem is that you've made a box with the size of a 50x50x50 meter. It is just too big, so when you render it, the smartphone appears inside the box. You either need to make it smaller or set doubleSided
property of the material to true
in order to make it render from the inside.
Here, I've cleaned up your sample a bit:
import 'package:arkit_plugin/arkit_plugin.dart';
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart';
class EarthPage extends StatefulWidget {
@override
_EarthPageState createState() => _EarthPageState();
}
class _EarthPageState extends State<EarthPage> {
ARKitController arkitController;
@override
void dispose() {
arkitController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('Earth Sample')),
body: Container(
child: ARKitSceneView(
onARKitViewCreated: onARKitViewCreated,
),
),
);
void onARKitViewCreated(ARKitController arkitController) {
this.arkitController = arkitController;
final material = ARKitMaterial(
lightingModelName: ARKitLightingModel.lambert,
diffuse: ARKitMaterialProperty(image: 'earth.jpg'),
doubleSided: true);
final box =
ARKitBox(materials: [material], width: 0.1, height: 0.1, length: 0.1);
final node = ARKitNode(
geometry: box,
position: Vector3(0, 0, -0.5),
);
this.arkitController.add(node);
}
}
I need an example to use ARKitBox and I try different method but is it not working
import 'dart:async';
https://stackoverflow.com/questions/64415300/how-to-use-arkitbox