Blender to ogre xml collision error

Hello. I create my scene (game level) in blender and have errors:

  1. I texture model with uv mapping, but render not view textures.
  2. I export model to ogre xml (to jmonkey) but textures not work.
  3. Code for listen key press not work.


Code from this collision example:

Part with key press have errors
Input manager can not be appliet in given types

    //inputManager.addListener(this, "Left");
    //inputManager.addListener(this, "Right");

public class GameLevel extends SimpleApplication{

     private Spatial sceneModel;
  private BulletAppState bulletAppState;
  private RigidBodyControl landscape;
  private CharacterControl player;
  private Vector3f walkDirection = new Vector3f();
  private boolean left = false, right = false, up = false, down = false;

  //Temporary vectors used on each frame.
  //They here to avoid instanciating new vectors on each frame
  private Vector3f camDir = new Vector3f();
  private Vector3f camLeft = new Vector3f();
    public GameLevel(){
   public void simpleInitApp() {
    /** Set up Physics */
    bulletAppState = new BulletAppState();

    // We re-use the flyby camera for rotation, while positioning is handled by physics
    viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f));

    // We load the scene from the zip file and adjust its size.
    assetManager.registerLocator("", ZipLocator.class);
    sceneModel = assetManager.loadModel("factory.scene");

    // We set up collision detection for the scene by creating a
    // compound collision shape and a static RigidBodyControl with mass zero.
    com.jme3.bullet.collision.shapes.CollisionShape sceneShape =
    landscape = new RigidBodyControl(sceneShape, 0);

    // We set up collision detection for the player by creating
    // a capsule collision shape and a CharacterControl.
    // The CharacterControl offers extra settings for
    // size, stepheight, jumping, falling, and gravity.
    // We also put the player in its starting position.
    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
    player = new CharacterControl(capsuleShape, 0.05f);
    player.setPhysicsLocation(new Vector3f(0, 10, 0));

    // We attach the scene and the player to the rootnode and the physics space,
    // to make them appear in the game world.

  private void setUpLight() {
    // We add light so we see the scene
    AmbientLight al = new AmbientLight();

    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());

  /** We over-write some navigational key mappings here, so we can
   * add physics-controlled walking and jumping: */
  private void setUpKeys() {
    inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_A));
    inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_D));
    inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_S));
    inputManager.addMapping("Jump", new KeyTrigger(KeyInput.KEY_SPACE));
    //inputManager.addListener(this, "Left");
    //inputManager.addListener(this, "Right");
   // inputManager.addListener(this, "Up");
   // inputManager.addListener(this, "Down");
   // inputManager.addListener(this, "Jump");

  /** These are our custom actions triggered by key presses.
   * We do not walk yet, we just keep track of the direction the user pressed. */
  public void onAction(String binding, boolean isPressed, float tpf) {
    if (binding.equals("Left")) {
      left = isPressed;
    } else if (binding.equals("Right")) {
      right= isPressed;
    } else if (binding.equals("Up")) {
      up = isPressed;
    } else if (binding.equals("Down")) {
      down = isPressed;
    } else if (binding.equals("Jump")) {
      if (isPressed) { player.jump(); }

   * This is the main event loop--walking happens here.
   * We check in which direction the player is walking by interpreting
   * the camera direction forward (camDir) and to the side (camLeft).
   * The setWalkDirection() command is what lets a physics-controlled player walk.
   * We also make sure here that the camera moves with player.
    public void simpleUpdate(float tpf) {
        walkDirection.set(0, 0, 0);
        if (left) {
        if (right) {
        if (up) {
        if (down) {

For 3., your class must implement com.jme3.input.controls.ActionListener:

public class GameLevel extends SimpleApplication implements ActionListener { ...

You have the correct onAction() method signature, but your class must declare that it implements the interface.

Thank. Run work.


Source blender:

Source ogre-xml:

  1. When level start player(capsule) can fall down for the level.
  2. Uses “standart” (first loaded in blender texture by default to all objects.
  3. Capsule (player) not crawls to the door. Small dor? big capsule?.

That’s because you have joined all objects to one mesh and this cause to have multiple materials for one mesh.

Also it seems you have not correctly UV mapped textures.

Need to make every object with texture separately? Thanks.
Why capsule not passes through the door?
How to make camera below?

Yes, each object should have only one material.

Enable physic debug mode then we can see what is going wrong.

In blender ? use shift+F
In JME ? see

I think space between polygons small

Then decrease the player radius, make it 0.5f for example, in the following line :

Thak’s. I think good thread - solve 99% problems.

Shake (jolting ) when player (camera) move.

Think need will remake scene. with separated objects and bigest scale and distance between objects.

1 Like

Hey, it’s more beautiful now. :slight_smile:
Good job friend.