Pakete, Repositories und App-Kategorien suchen

Paketdetailsv1.0.2+1

flutter_3d_objects

Ein Flutter-Paketprojekt, das Wavefront-3D-Objektdateien rendert.

AndroidiOSmacOSWindowsLinux
30-Tage-Downloads
2
Likes
5
Pub-Punkte
135

Paket installieren

flutter pub add flutter_3d_objects

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein Flutter-Paket, das die Darstellung von Wavefront (.obj)-3D-Modelldateien innerhalb von Flutter-Anwendungen ermöglicht. Es unterstützt mehrere Plattformen wie Android, iOS, macOS, Windows und Linux und ist daher ideal für plattformübergreifende 3D-Visualisierung. Das Paket integriert sich nahtlos in das Widget-System von Flutter und ermöglicht Entwicklern, interaktive 3D-Objekte in ihre Benutzeroberflächen einzubetten. Besonders nützlich ist es für Anwendungen, die die Anzeige von 3D-Assets erfordern, wie z. B. Produktvorschauen, Lernwerkzeuge oder Erlebnisse in der erweiterten Realität.

Anwendungsfälle

  • 3D-Produktvisualisierung
  • Lernapps mit 3D-Modellen
  • verstärkte Realitätsschnittstellen
  • Interaktive 3D-UI-Komponenten
  • Spieleentwicklungsprototypen

Hauptmerkmale

  • Unterstützt Wavefront .obj-Dateien
  • Plattformübergreifende Kompatibilität
  • Integration mit Flutter-Widgets
  • Leicht und einfach zu bedienen
  • Echtzeit-3D-Rendering

Geeignet für

  • Entwickler, die 3D-fähige Flutter-Apps erstellen
  • Entwickler von Bildungssoftware
  • Produktpräsentationsanwendungen
  • AR/VR-Prototypen-Teams
  • UI-Designer erkunden 3D-Elemente

Hinweise

  • Beschränkt auf das .obj-Dateiformat
  • Keine integrierte Animationsunterstützung
  • Benötigt 3D-Modell-Optimierung
  • Kann sich negativ auf die Leistung bei Geräten mit geringer Leistung auswirken
  • Keine Texturabbildung aus der Box

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

[Flutter 3D Objects]

pub package style: effective dart License: MIT

This package allows Flutter developers to easily display 3D models in their applications. It supports the .obj file format and provides functionalities to manipulate the scene, including setting camera positions and adding objects with child objects.

Features:

  • Display 3D models from .obj files
  • Add and manipulate objects within the scene
  • Set camera positions to adjust the view
  • Support for hierarchical object structures

Setup

How to use this

  • Add dependency in pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
flutter_3d_objects:
  • Add 3D Models in assets, file type should be .obj
flutter:
assets:
  - assets/p.obj
  - assets/c.obj

Usage

void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Cube(
            onSceneCreated: (Scene scene) {
              scene.world.add(
                Object(
                  fileName: 'assets/c.obj',
                  position: Vector3(1, 1, 1),
                  scale: Vector3(1, 1, 1),
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}

Example

//Create a variable
late Scene _scene;
double x = 0;
double y = 3;
double z = 8;
late AnimationController _controller;
late Animation<double> _animation;
Object? _p;

// Create Function
void _onSceneCreated(Scene scene) {
   _scene = scene;
   scene.camera.position.z = z;
   scene.camera.position.y = y;
   scene.camera.position.x = x;
   _p = Object(
       position: Vector3(0, -2.5, 0),
       scale: Vector3(4, 4, 4),
       fileName: 'assets/p.obj',
       children: [
         Object(
           fileName: 'assets/c.obj',
           position: Vector3(0.25, 0.15, -0.24),
           scale: Vector3(0.8, 0.8, 0.8),
         ),
       ]);
   scene.world.add(_p!);
 }

//Function to rotate
void rotateLeft() {
   _animateRotation(90);
 }

 void rotateRight() {
   _animateRotation(-90);
 }

 void _animateRotation(double angle) {
   final double begin = _p!.rotation.y;
   final double end = _p!.rotation.y + angle;

   _animation = Tween<double>(begin: begin, end: end).animate(_controller)
     ..addListener(() {
       setState(() {
         _p!.rotation.y = _animation.value;
         _p!.updateTransform();
         _scene.update();
       });
     });

   _controller.forward(from: 0);
 }

// In main widget function
Scaffold(
     appBar: AppBar(
       title: const Text(''),
     ),
     body: Stack(
       children: [
         Cube(
           interactive: false,
           zoom: false,
           onSceneCreated: _onSceneCreated,
         ),
         Positioned(
           bottom: 10,
           left: 0,
           right: 0,
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceEvenly,
             children: [
               ElevatedButton(
                 onPressed: rotateLeft,
                 child: const Text('Left'),
               ),
               ElevatedButton(
                 onPressed: rotateRight,
                 child: const Text('Right'),
               ),
             ],
           ),
         ),
       ],
     ),
   );

Kategorien

Abhängigkeiten

Abhängigkeiten 2 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.