Simulation of games

i installed jme sdk 3.0 and i do a animation with 3dsmax 2010 when i installed with him OgreMaxSceneExporter2.6.3-3DSMax-NonCommercial.
the export the animation from 3dsmax 2010 with formats .scene or .mesh.xml was done successfully and jme sdk read the animation but not the same of 3dsmax it is inorganised
please help me. and thx

Well, ogrexml doesn’t support all 3dsmax features, and jme probably doesn’t support all ogrexml features.
Make sure:

If those changes don’t work, maybe try and remove stuff in 3dsmax in order to spot what causes the problem. Or better, make a very simple animated snowman and try and get that imported into jme. Then, add more complex stuff to see what causes the glitch.

Anyway, you really should give more information if you want useful help. You should go out of your way to provide all useful info, such as pictures, eventual logs, whatever; also, what special stuff you do and so on.

NB: I think jme can display your bones (don’t remember how)… provides interesting info.

1 Like

i do the same steps of this toto - YouTube
and after i make thie same steps of this documentation https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:3dsmax

public static void main(String[] args) {
TestCinematic app = new TestCinematic();
app.start();

}
private AnimControl control;

@Override
public void simpleInitApp() {
    //just some text
    

     flyCam.setMoveSpeed(120f);

    createScene();

    cinematic = new Cinematic(rootNode, 20);
    stateManager.attach(cinematic);

   cinematic.addCinematicEvent(2, new AnimationEvent(model, "walk", LoopMode.Loop));

    initInputs();
}

private void createCameraMotion() {

    CameraNode camNode = cinematic.bindCamera("topView", cam);
    camNode.setLocalTranslation(new Vector3f(0, 50, 0));
  //  camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y);

    CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
    path = new MotionPath();
    path.setCycle(true);
    path.addWayPoint(new Vector3f(20, 3, 0));
    path.addWayPoint(new Vector3f(0, 3, 20));
    path.addWayPoint(new Vector3f(-20, 3, 0));
    path.addWayPoint(new Vector3f(0, 3, -20));
    path.setCurveTension(0.83f);
    cameraMotionEvent = new MotionEvent(camNode2, path);
    cameraMotionEvent.setLoopMode(LoopMode.Loop);
    cameraMotionEvent.setLookAt(model.getWorldTranslation(), Vector3f.UNIT_Y);
    cameraMotionEvent.setDirectionType(MotionEvent.Direction.LookAt);

}

private void createScene() {

    model = (Spatial) assetManager.loadModel("Textures/testanim/guy4.scene");
    model.center();
    model.setShadowMode(ShadowMode.CastAndReceive); 
 //   model.setLocalScale(0.05f);
    rootNode.attachChild(model);
    


    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Cyan);



    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Gray);
    matSoil.setColor("Diffuse", ColorRGBA.Green);
    matSoil.setColor("Specular", ColorRGBA.Black);

    Geometry soil = new Geometry("soil", new Box(new Vector3f(0, -6.0f, 0), 50, 1, 50));
    soil.setMaterial(matSoil);
    soil.setShadowMode(ShadowMode.Receive);
    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);

   
}

private void initInputs() {
    inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
    inputManager.addMapping("navFwd", new KeyTrigger(keyInput.KEY_RIGHT));
    inputManager.addMapping("navBack", new KeyTrigger(keyInput.KEY_LEFT));
    ActionListener acl = new ActionListener() {

        public void onAction(String name, boolean keyPressed, float tpf) {
            if (name.equals("togglePause") && keyPressed) {
                if (cinematic.getPlayState() == PlayState.Playing) {
                    cinematic.pause();
                    time = cinematic.getTime();
                } else {
                    cinematic.play();
                }
            }

            if (cinematic.getPlayState() != PlayState.Playing) {
                if (name.equals("navFwd") && keyPressed) {
                    time += 0.25;
                    FastMath.clamp(time, 0, cinematic.getInitialDuration());
                    cinematic.setTime(time);
                }
                if (name.equals("navBack") && keyPressed) {
                    time -= 0.25;
                    FastMath.clamp(time, 0, cinematic.getInitialDuration());
                    cinematic.setTime(time);
                }

            }
        }
    };
    inputManager.addListener(acl, "togglePause", "navFwd", "navBack");
}

private class FadeEvent extends AbstractCinematicEvent {

    boolean in = true;
    float value = 0;

    public FadeEvent(boolean in) {
        super(1);
        this.in = in;
        value = in ? 0 : 1;
    }

    @Override
    public void onPlay() {

        fade.setDuration(1f / cinematic.getSpeed());
        if (in) {
            fade.fadeIn();
        } else {
            fade.fadeOut();
        }
        fade.setValue(value);

    }

    @Override
    public void setTime(float time) {
        super.setTime(time);
        if (time >= fade.getDuration()) {
            value = in ? 1 : 0;
            fade.setValue(value);
        } else {
            value = time;
            if (in) {
                fade.setValue(time / cinematic.getSpeed());
            } else {
                fade.setValue(1 - time / cinematic.getSpeed());
            }
        }
    }

    @Override
    public void onUpdate(float tpf) {
    }

    @Override
    public void onStop() {
    }

    @Override
    public void onPause() {
        value = fade.getValue();
        fade.pause();
    }
}

that’s not work the simulation is not the same of 3dsmax
i don’t inderstant where is the problem

public static void main(String[] args) {
TestCinematic app = new TestCinematic();
app.start();

}
private AnimControl control;

@Override
public void simpleInitApp() {
    //just some text
    

     flyCam.setMoveSpeed(120f);

    createScene();

    cinematic = new Cinematic(rootNode, 20);
    stateManager.attach(cinematic);

   cinematic.addCinematicEvent(2, new AnimationEvent(model, "walk", LoopMode.Loop));

    initInputs();
}

private void createCameraMotion() {

    CameraNode camNode = cinematic.bindCamera("topView", cam);
    camNode.setLocalTranslation(new Vector3f(0, 50, 0));
  //  camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y);

    CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
    path = new MotionPath();
    path.setCycle(true);
    path.addWayPoint(new Vector3f(20, 3, 0));
    path.addWayPoint(new Vector3f(0, 3, 20));
    path.addWayPoint(new Vector3f(-20, 3, 0));
    path.addWayPoint(new Vector3f(0, 3, -20));
    path.setCurveTension(0.83f);
    cameraMotionEvent = new MotionEvent(camNode2, path);
    cameraMotionEvent.setLoopMode(LoopMode.Loop);
    cameraMotionEvent.setLookAt(model.getWorldTranslation(), Vector3f.UNIT_Y);
    cameraMotionEvent.setDirectionType(MotionEvent.Direction.LookAt);

}

private void createScene() {

    model = (Spatial) assetManager.loadModel("Textures/testanim/guy4.scene");
    model.center();
    model.setShadowMode(ShadowMode.CastAndReceive); 
 //   model.setLocalScale(0.05f);
    rootNode.attachChild(model);
    


    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Cyan);



    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Gray);
    matSoil.setColor("Diffuse", ColorRGBA.Green);
    matSoil.setColor("Specular", ColorRGBA.Black);

    Geometry soil = new Geometry("soil", new Box(new Vector3f(0, -6.0f, 0), 50, 1, 50));
    soil.setMaterial(matSoil);
    soil.setShadowMode(ShadowMode.Receive);
    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);

   
}

private void initInputs() {
    inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
    inputManager.addMapping("navFwd", new KeyTrigger(keyInput.KEY_RIGHT));
    inputManager.addMapping("navBack", new KeyTrigger(keyInput.KEY_LEFT));
    ActionListener acl = new ActionListener() {

        public void onAction(String name, boolean keyPressed, float tpf) {
            if (name.equals("togglePause") && keyPressed) {
                if (cinematic.getPlayState() == PlayState.Playing) {
                    cinematic.pause();
                    time = cinematic.getTime();
                } else {
                    cinematic.play();
                }
            }

            if (cinematic.getPlayState() != PlayState.Playing) {
                if (name.equals("navFwd") && keyPressed) {
                    time += 0.25;
                    FastMath.clamp(time, 0, cinematic.getInitialDuration());
                    cinematic.setTime(time);
                }
                if (name.equals("navBack") && keyPressed) {
                    time -= 0.25;
                    FastMath.clamp(time, 0, cinematic.getInitialDuration());
                    cinematic.setTime(time);
                }

            }
        }
    };
    inputManager.addListener(acl, "togglePause", "navFwd", "navBack");
}

private class FadeEvent extends AbstractCinematicEvent {

    boolean in = true;
    float value = 0;

    public FadeEvent(boolean in) {
        super(1);
        this.in = in;
        value = in ? 0 : 1;
    }

    @Override
    public void onPlay() {

        fade.setDuration(1f / cinematic.getSpeed());
        if (in) {
            fade.fadeIn();
        } else {
            fade.fadeOut();
        }
        fade.setValue(value);

    }

    @Override
    public void setTime(float time) {
        super.setTime(time);
        if (time >= fade.getDuration()) {
            value = in ? 1 : 0;
            fade.setValue(value);
        } else {
            value = time;
            if (in) {
                fade.setValue(time / cinematic.getSpeed());
            } else {
                fade.setValue(1 - time / cinematic.getSpeed());
            }
        }
    }

    @Override
    public void onUpdate(float tpf) {
    }

    @Override
    public void onStop() {
    }

    @Override
    public void onPause() {
        value = fade.getValue();
        fade.pause();
    }
}

that’s not work the simulation is not the same of 3dsmax
i don’t inderstant where is the problem
thx for replay

what’s stuff??
i do some test with jme in simple model and they run

what’s this ??

@ahtaimise said: what's this ??

Well, in case you wondered why your posted code looks completely ugly and unformatted while everyone else’s code looks nice and formatted… that’s the button you need.

this code existe in jme but thx
however can you help me in my problem
i installed jme sdk 3.0 and i do a animation with 3dsmax 2010 when i installed with him OgreMaxSceneExporter2.6.3-3DSMax-NonCommercial.
the export the animation from 3dsmax 2010 with formats .scene or .mesh.xml was done successfully and jme sdk read the animation but not the same of 3dsmax it is inorganised

3 Likes

You should edit your posts where you provided code and surround the code with code tags (icon is “##”) to make them easier to read.

My guess would be you don’t apply transforms on the geometries (not sure if needed on the bones too). But it’s a hit in the dark.

If the simple model works and not the other one, then, try and see what’s the difference in the sense, what special 3dsmax feature are you using that maybe isn’t ogre or jme friendly.

If you could provide a picture of your model and it’s bones in jme, it probably would help a lot finding the problem.

I’m mostly helping you clear up a couple points and end up with enough data so someone with experience with 3dsmax exporting could help you.

1 Like

i do some test with a simple model now but the some problem


file:///C:/Users/ahmed1/Desktop/in%20jme.PNG

file:///C:/Users/ahmed1/Desktop/in%20jme.PNG"><img src=" <img src=“file:///C:/Users/ahmed1/Desktop/in%203dsmax.PNG” alt="" /> file:///C:/Users/ahmed1/Desktop/in%20jme.PNG" alt="" />

Sorry i’m going to be crazy i have no solution

how make a picture in this place

Well, you have to upload the image to somewhere we could all see it. It doesn’t do us any good just sitting on your desktop. (I recommend http://imgur.com/ though it’s become clearer that JME may be too hard for you at this point in your learning process.)