https://github.com/erasin/bevy_vox
Load MagicaVoxel Vox file for bevy engine.
https://github.com/erasin/bevy_vox
bevy bevy-plugin
Last synced: 9 months ago
JSON representation
Load MagicaVoxel Vox file for bevy engine.
- Host: GitHub
- URL: https://github.com/erasin/bevy_vox
- Owner: erasin
- License: mit
- Created: 2020-10-17T07:48:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-30T08:36:31.000Z (about 1 year ago)
- Last Synced: 2025-03-29T10:05:05.972Z (10 months ago)
- Topics: bevy, bevy-plugin
- Language: Rust
- Homepage:
- Size: 53.7 KB
- Stars: 45
- Watchers: 1
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
Load MagicaVoxel Vox file for [bevy](https://github.com/bevyengine/bevy/) engine.
| bevy_vox | bevy |
| -------- | ----- |
| follow | >=0.15|
| 0.10 | 0.14 |
**Example**
```rust
use bevy::prelude::*;
use bevy_vox::VoxPlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(VoxPlugin { swap_yz: true })
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.5,
})
.add_systems(Startup, setup)
.add_systems(Update, rotate_model)
.run();
}
#[derive(Component)]
struct VoxModel;
fn setup(mut commands: Commands, asset_server: Res) {
// add entities to the world
commands.spawn((
SceneRoot(asset_server.load("2x2x2.vox")),
Transform::from_xyz(-1.0, 0.0, 0.0),
VoxModel,
));
// light
commands.spawn((
PointLight {
intensity: 3_000_000.0,
..Default::default()
},
Transform::from_xyz(3.0, -3.5, 4.5),
));
// camera
commands.spawn((
Camera3d::default(),
Transform::from_xyz(6.0, -6.0, 6.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}
fn rotate_model(mut query: Query<&mut Transform, With>, time: Res