mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
0e13b1ca5e
Reference to #14299. # Objective - Ensuring consistent practice of instantiating 3D primitive shapes in Bevy. ## Solution - Add `new` method, containing `radius` and `height` arguments, to Cone 3D primitive shape. ## Testing - Instantiated cone using same values (radius is `2.` and height is `5.`), using the current method and the added `new` method. - Basic setup of Bevy Default Plugins and `3DCameraBundle`. --- ## Showcase <details> <summary>Click to view showcase</summary> ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { let new_cone = meshes.add(Cone::new(2., 5.)); commands.spawn(PbrBundle { mesh: new_cone, ..default() }); let old_cone = meshes.add(Cone { radius: 2., height: 5., }); commands.spawn(PbrBundle { mesh: old_cone, material: materials.add(Color::WHITE), transform: Transform::from_xyz(10., 0., 0.), ..default() }); commands.spawn(Camera3dBundle { transform: Transform::from_xyz(20., 20., 20.).looking_at(Vec3::ZERO, Dir3::Y), ..default() }); } ``` </details> ![image](https://github.com/user-attachments/assets/267f8124-8734-4c20-8840-fcf35375a778) - Pink Cone is created using the `new` method. - Black Cone is created using the existing method. ## Migration Guide - Addition of `new` method to the 3D primitive Cone struct. |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |