bevy/crates
Steve Frampton 0e13b1ca5e
Added new method to Cone 3D primitive (#14325)
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.
2024-07-16 12:59:26 +00:00
..
bevy_a11y plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_animation Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_app plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_asset add debug logging to ascertain the base path the asset server is using (#13820) 2024-07-15 14:00:43 +00:00
bevy_audio Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_color Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_core Rename bevy_core::name::DebugName to bevy_core::name::NameOrEntity (#14211) 2024-07-15 15:21:41 +00:00
bevy_core_pipeline Fix error/typo in SMAA shader (#14338) 2024-07-15 23:40:39 +00:00
bevy_derive Specify test group names in github summary for compile fail tests (#14330) 2024-07-15 16:13:03 +00:00
bevy_dev_tools plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_diagnostic Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_dylib Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_dynamic_plugin Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_ecs Add insert_by_id and try_insert_by_id to EntityCommands (#14283) 2024-07-15 23:29:13 +00:00
bevy_encase_derive Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_gilrs Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_gizmos plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_gltf Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_hierarchy Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00
bevy_input Expose Winit's KeyEvent::repeat in KeyboardInput (#14161) 2024-07-15 14:52:33 +00:00
bevy_internal plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_log Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_macro_utils Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_math Added new method to Cone 3D primitive (#14325) 2024-07-16 12:59:26 +00:00
bevy_mikktspace Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_pbr Allow volumetric fog to be localized to specific, optionally voxelized, regions. (#14099) 2024-07-16 03:14:12 +00:00
bevy_picking Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_ptr Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_reflect bevy_reflect: Add DynamicClosure and DynamicClosureMut (#14141) 2024-07-16 03:22:43 +00:00
bevy_render Clearer spatial bundle pub const docs (#14293) 2024-07-15 16:03:09 +00:00
bevy_scene Align Scene::write_to_world_with to match DynamicScene::write_to_world_with (#13855) 2024-07-15 14:04:09 +00:00
bevy_sprite Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_state plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_tasks Make Tasks functional on WASM (#13889) 2024-07-16 01:15:03 +00:00
bevy_text Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_time Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_transform Clarify GlobalTransform::transform_point (#14292) 2024-07-15 15:59:29 +00:00
bevy_ui Clean up UiSystem system sets (#14228) 2024-07-15 15:27:38 +00:00
bevy_utils Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_window Remove unused default feature from bevy_window (#14313) 2024-07-15 16:49:00 +00:00
bevy_winit Remove need for EventLoopProxy to be NonSend (#14198) 2024-07-16 06:59:01 +00:00