Crates.io | bevy_basic_portals |
lib.rs | bevy_basic_portals |
version | |
source | src |
created_at | 2023-05-21 04:21:21.977345 |
updated_at | 2024-12-04 11:33:07.612775 |
description | A portal plugin for Bevy game engine |
homepage | |
repository | https://github.com/Selene-Amanita/bevy_basic_portals |
max_upload_size | |
id | 869752 |
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` |
size | 0 |
Bevy Basic Portals is a Bevy game engine plugin aimed to create portals.
Those portals are (for now) purely visual and can be used to make mirrors, indoor renderings, crystal balls, and more!
This example illustrates how to create a simple portal, it uses a single sphere that will be displayed two times on screen thanks to the portal:
use bevy::prelude::*;
use bevy_basic_portals::*;
fn main() {
App::new()
.add_plugins((DefaultPlugins, PortalsPlugin::MINIMAL))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
commands.spawn((
Camera3d::default(),
Transform::from_xyz(-20.0, 0., 20.0).looking_at(Vec3::ZERO, Vec3::Y),
));
let portal_mesh = meshes.add(Mesh::from(Rectangle::new(10., 10.)));
commands.spawn((
// This component will be deleted and things that are needed to create the portal will be created
CreatePortal {
destination: AsPortalDestination::Create(CreatePortalDestination {
transform: Transform::from_xyz(20., 0., 0.),
..default()
}),
// Uncomment this to see the portal
/*debug: Some(DebugPortal {
show_window: false,
..default()
}),*/
..default()
},
Mesh3d(portal_mesh),
));
let sphere_mesh = meshes.add(Mesh::from(Sphere::new(2.).mesh().uv(32, 18)));
commands.spawn((
Mesh3d(sphere_mesh),
MeshMaterial3d::<StandardMaterial>::default(),
Transform::from_xyz(20., 0., -5.),
));
}
More complex examples are available in the examples folder.
(may be fixed in the future)
DebugPortal
Bevy version | Bevy Basic Portals recommended version |
---|---|
0.15.* | 0.7.0 |
0.14.* | 0.6.0 |
0.13.* | 0.5.0 |
0.12.* | 0.4.0 |
0.11.1 | 0.3.0 |
0.10.* | 0.2.1 |
Bevy Basic Portals is non-violent software: you can use, redistribute, and/or modify it under the terms of the NVPLv7+
as found in the LICENSE
file in the source code root directory or at the CNPL repository.
Bevy Basic Portals comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
See the CNPL website for more information.