'3d Models are not properly showing by the "flutter_cube: ^0.0.4" in flutter
It is not showing proper 3d models it shows only the shadow
of the models. How I am wrong or How it will show the same models?
Both pictures are here
real model png
while .obj file load it shows like this.
3d files is here
import 'package:flutter/material.dart';
import 'package:flutter_cube/flutter_cube.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
late Object jet;
@override
void initState() {
jet = Object(fileName: "assets/model/odb.obj");
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.red,
title: Text("Flutter 3D"),
),
body: Container(
child: Column(
children: [
Expanded(
child: Cube(
onSceneCreated: (Scene scene) {
scene.world.add(jet);
scene.camera.zoom = 8;
},
),
),
// Expanded(
// child: Cube(
// onSceneCreated: (Scene scene) {
// scene.world.add(jet);
// scene.camera.zoom = 10;
// },
// ),
// ),
],
),
),
);
}
}
Solution 1:[1]
I used "flutter_cube" yestoday,it worked very well.But it can't load the normal_mapping image about obj files. I think you can try new version of flutter_cube(0.1.1),just use the code below:
Cube(
onSceneCreated: (Scene scene) {
scene.world.add(Object(fileName: 'assets/cube/cube.obj'));
},
),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | qing ye |