jmonkey Cloth system

https://hub.jmonkeyengine.org/t/cloth-system/46547/8


The boots also need to have vertex groups setup properly to match the Armature that they’re being added to.


 @Override

    public void simpleInitApp() {

        Node player= (Node)assetManager.loadModel("Models/test.glb");

        Node playerArmature = (Node)player.getChild("Armature");

        

        AnimComposer playerAnim = playerArmature.getControl(AnimComposer.class); 


        rootNode.attachChild(player);

        

        Node boots= (Node)assetManager.loadModel("Models/test2.j3o");

        Geometry bootsGeom= (Geometry)boots.getChild("Sphere");


        


        //1. Attach clothing to the animated model.

        playerArmature.attachChild(bootsGeom);

        

        //2 Detach the animated model from the scene

        rootNode.detachChild(player);

        

        //3 reload 

        SkinningControl skinningControl = ((Node) playerArmature).getControl(SkinningControl.class);    


        if(skinningControl != null){

           Armature armature = skinningControl.getArmature();

            playerArmature.removeControl(skinningControl);


            playerArmature.addControl(new SkinningControl(armature));

        }

        //4 attach 

        rootNode.attachChild(player);

        

        playerAnim.setCurrentAction("run");        

        setUpLight();

    }

Комментарии

Популярные сообщения из этого блога

jmonkey engine create and build andoid project

install Jmoneky engine for andoid ubuntu

jmonkey custom crursor