Skip to content

docs: picking requires RenderAssetUsages::MAIN_WORLD #19102

@francisdb

Description

@francisdb

How can Bevy's documentation be improved?

I was creating meshes like this. (Got the code from some example I think)

let mut bevy_mesh = Mesh::new(
    PrimitiveTopology::TriangleList,
    RenderAssetUsages::RENDER_WORLD,
);
bevy_mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, positions);
...
commands
   .spawn((
        Name::new(primitive.name.to_string()),
        Mesh3d(meshes.add(bevy_mesh)),
        ...

Everything seemed to be rendered correctly but to my surprise picking was only working for bevy primitives and not for my meshes. After quite some searching I found out that I need to set the asset_usage to

RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD
// or
RenderAssetUsages::default()

to be able to pick the mesh.

Documenting that RenderAssetUsages::MAIN_WORLD requirement would have saved me a lot of time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-PickingPointing at and selecting objects of all sortsC-DocsAn addition or correction to our documentationD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions