bevy_dae

Crates.iobevy_dae
lib.rsbevy_dae
version
sourcesrc
created_at2025-05-06 10:49:11.501528+00
updated_at2025-05-06 10:49:11.501528+00
descriptionA Bevy plugin for loading and rendering DAE (Collada) files.
homepage
repository
max_upload_size
id1662207
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Goutham S Krishna (gouthamsk98)

documentation

README

bevy_dae

A Bevy plugin for loading and rendering DAE (Collada) files in the Bevy game engine.

Crates.io MIT/Apache 2.0 Bevy tracking

Features

  • Load and render DAE (Collada) files in Bevy
  • Convert Collada meshes to Bevy meshes
  • Support for meshes, materials, and textures
  • Compatible with Bevy 0.16.0

Installation

Add the following to your Cargo.toml:

[dependencies]
bevy_dae = "0.1.0"

Usage

use bevy::prelude::*;
use bevy_dae::ColladaPlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(ColladaPlugin)
        .add_systems(Startup, setup)
        .run();
}

fn setup(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
    mut materials: ResMut<Assets<StandardMaterial>>
) {
    // Load and spawn a COLLADA model
    commands.spawn((
        Mesh3d(asset_server.load("models/your_model.dae")),
        MeshMaterial3d(
            materials.add(StandardMaterial {
                base_color: Color::rgb(0.8, 0.7, 0.6),
                perceptual_roughness: 0.5,
                metallic: 0.2,
                ..default()
            })
        ),
        Transform::from_scale(Vec3::splat(0.5)),
    ));

    // Add a camera
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(0.0, 1.5, 5.0)
            .looking_at(Vec3::new(0.0, 0.5, 0.0), Vec3::Y),
        ..default()
    });

    // Add some light
    commands.spawn(PointLightBundle {
        point_light: PointLight {
            intensity: 1500.0,
            shadows_enabled: true,
            ..default()
        },
        transform: Transform::from_xyz(4.0, 8.0, 4.0),
        ..default()
    });
}

Utility Functions

The library also provides utility functions for working with DAE files:

use bevy_dae::dae_to_triangle_mesh;
use mesh_loader::collada::from_str;

// Load a Collada file
let collada_str = include_str!("models/your_model.dae");
let collada = from_str(collada_str).unwrap();

// Convert a DAE mesh to a Bevy triangle mesh
if let Some(triangle_mesh) = dae_to_triangle_mesh(&collada, 0) {
    // Use the converted mesh...
}

Examples

Check out the examples folder for working examples:

  • joint.rs - Demonstrates loading and rendering a jointed model

Run an example with:

cargo run --example joint

License

Licensed under MIT license (LICENSE).

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

Acknowledgments

  • Built on top of the mesh-loader crate for Collada file parsing
  • Special thanks to the Bevy community for their support and guidance
Commit count: 0

cargo fmt