#XPBD Scene Mesh to Trishmesh Help

7 messages · Page 1 of 1 (latest)

rotund rose
#

Hi! I have a very simple mesh I made in Blender and imported as a gltf. I want to use the "trimesh_from_bevy_mesh" feature from XPBD to make a collider, but I'm not sure how to grab it.

    commands.spawn((
        SceneBundle {
            scene: asset_server.load("models/triangle_terrain.glb#Scene0"),
            ..default()
        },
        RigidBody::Static,
        Position(Vec3::Y),
        Collider::trimesh_from_bevy_mesh(&shape).unwrap(),
    ));```

Here is the spawn command I have so far. The **&shape** should be the mesh from "triangle_terrain", but I am not sure how to use it here.

 If there is a better way of doing specifically triangle mesh terrain, let me know! Otherwise, I'd like to try and attempt this.
stiff bone
#

It might currently have some issues though, the PR was mainly made for debugging a transform problem

#

It also might not work if the gltf has nesting since that would probably require child colliders which aren't implemented quite yet

#

But you can test if it works for your case, just copy init_async_scene_colliders and AsyncSceneCollider into your app

#

then add the component for the entity with the mesh, and the collider(s) should get inserted once the mesh is ready

#

Proper support for async colliders / scene colliders will be added once child colliders are implemented