A Wavefront .obj mesh asset loader plugin for the Bevy engine
Add the crate as a dependency:
Major and Minor version number should match bevy version
[dependencies]
bevy = "0.13"
bevy_obj = "0.13"
Add the plugin:
use bevy::prelude::*;
use bevy_obj::ObjPlugin;
fn main() {
App::new()
.add_plugins((DefaultPlugins, ObjPlugin))
.run();
}
Load the .obj
file as a single mesh:
fn example_startup_system(asset_server: Res<AssetServer>) {
let mesh_handle = asset_server.load("example.obj");
}
If you prefer loading .obj
files as a scene with (limited) MTL material support, add the scene
feature
[dependencies]
bevy = "0.13"
bevy_obj = { version = "0.13", features = ["scene"] }