[SOLVED..?] Node Model Animation Disappears

I have an issue with my reloading animation, which was done in blender and imported and converted to a j3o. The animation is working perfectly, but the only problem is that the magazine disappears when I start the program, and only at certain angles it appears. It kinda gets rid of the purpose, so I need to fix the issue, but I don’t know how.

I think I have to call player.updateModelBounds BUT I don’t know where and how to do it right.
Main1Main2
P.S: player is a Node

      @Override
       public void simpleInitApp() {
       ScreenshotAppState screenShotState = new ScreenshotAppState();
player = (Node) assetManager.loadModel("Models/reload.j3o");
player.setLocalScale(1);

rootNode.attachChild(player);

  Node terrain = (Node) assetManager.loadModel("Models/newScene.j3o");
terrain.setLocalScale(1);
rootNode.attachChild(terrain);
flyCam.setMoveSpeed(50);

control = player.getChild("Cube").getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
channel.setAnim("reload");

if (!channel.getAnimationName().equals("reload")){
            channel.setAnim("reload", 0.50f);
            channel.setLoopMode(LoopMode.Loop);
            channel.setSpeed(1f);
        }
  


     }
    public void simpleUpdate(float tpf) {
  

  Vector3f vectorDifference = new 
  Vector3f(cam.getLocation().subtract(player.getWorldTranslation()));
    player.setLocalTranslation(vectorDifference.addLocal(player.getLocalTranslation()));
    
    
    Quaternion worldDiff = new 
  Quaternion(cam.getRotation().mult(player.getWorldRotation().inverse()));
    player.setLocalRotation(worldDiff.multLocal(player.getLocalRotation()));
    //Move gun to the bottom right of the screen
    player.move(cam.getDirection().mult(17f));
    player.move(cam.getUp().mult(-5f));
    player.move(cam.getLeft().mult(-3f));
    player.rotate(0.0f,0,0);

 }

Try setting the spatial’s Cull mode from Dynamic to Never. It sounds like your object may be disappearing because the engine thinks it’s outside of the camera’s view port / frustum at certain angles, especially when you’re working with objects really close to the camera from a first person view

1 Like

Thank you! This solved the issue. It issue REALLY bugged me.

Disabling culling should not be the solution. Are you sure your model has normals set correctly?

I’ve thought this was the only way to fix objects clipping out of view, but I’d be happy to learn about any better or cleaner ways to do so :relaxed:

Objects won’t “clip out of view” unless they are actually “out of view”… unless the objects are screwed up. Usually this is an object with a bad bounding shape.

2 Likes