#Access the triangles of the model

18 messages · Page 1 of 1 (latest)

tranquil wasp
#

Hello! Im a newbie of bevy and I want to access the triangles of the model after loading it into the scene since i want to iterate the triangles(read). i searched online but there's no result. is there any way to achieve this?

timid crow
#

After you asset is loaded you can access it via Res<Assets<Mesh>>.

eg

fn modify_mesh(mut meshes: ResMut<Assets<Mesh>>) {
    let my_asset_handle: Handle<Mesh> = ...;
    let mesh = meshes.get_mut(&my_asset_handle).unwrap();
}
tranquil wasp
#

can this one be used to access the triangles?

tranquil wasp
tranquil wasp
#

Since the loading of mesh is parallel, i dont know how to wait until the completion of loading the model

timid crow
#

how are you loading the mesh in the first place?

timid crow
tranquil wasp
timid crow
#

This process is a bit clunky in Bevy at the moment, hopefully it gets better in future versions

#

it's unfortunate there's not an example of how to do this in the repository

tranquil wasp
#

Thank you! I'll try that

timid crow
timid crow
#

I meant like an example showing loading an asset from disk then modifying it at runtime like what you're trying to do

#

get_load_state is more useful because it will also tell you if the asset failed to load etc