Animation, motion in the water, the interaction models and more

duplicate message potmou to find the answer
http://hub.jmonkeyengine.org/forum/topic/character-animation-character-control-camera-control/#post-212678

learning materials have come to such a form of code.
[java]
package li.pack;

import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.control.BetterCharacterControl;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.input.ChaseCamera;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;
import com.jme3.shadow.PssmShadowRenderer;
import java.util.Random;

public class Main extends SimpleApplication implements ActionListener, AnimEventListener{

private BulletAppState bulletAppState;
private BetterCharacterControl charControl;
ChaseCamera chaseCam;
private Node model;
private Node monet;
PhysicsSpace space;
AnimChannel animationChannel;
AnimControl animationControl;
private PssmShadowRenderer pssmRenderer;
private static Random random = new Random();
float airTime = 0;
float speed = 1f;
String move;
Geometry geom1;
boolean left = false, right = false, up = false, down = false, jump = false,
run = false;
Vector3f walkDirection = new Vector3f();

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


@Override
public void simpleInitApp() {
    //физика
       bulletAppState = new BulletAppState();
       stateManager.attach(bulletAppState);
       bulletAppState.setDebugEnabled(true);
       
    //загружаем сцену
    Scene.CreateScene(rootNode, assetManager, PhysicsSpace.getPhysicsSpace());
    
    setupKeys();
    createCharacter();
    createMonet();
    createBall(PhysicsSpace.getPhysicsSpace());
    createShadow(); 
    setupAnimationController();
       }

private void createShadow(){
/** Advanced shadows for uneven surfaces */ 

pssmRenderer = new PssmShadowRenderer(assetManager, 1024, 5);
pssmRenderer.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
viewPort.addProcessor(pssmRenderer);
}

private void createCharacter(){
    charControl = new BetterCharacterControl(0.5f, 1.5f, 20f);
    getPhysicsSpace().add(charControl);
    // загружаем модель
    model = (Node) assetManager.loadModel("Models/Jaime/Jaime.j3o");
    model.setLocalScale(1f);  // размер модели
    model.addControl(charControl);
    model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
    // добавляем Node чара на карту
    rootNode.attachChild(model);
    //камера
    flyCam.setEnabled(false);
    chaseCam = new ChaseCamera(cam, model, inputManager);
    }

private void setupKeys() {
    inputManager.addMapping("run", new KeyTrigger(KeyInput.KEY_LSHIFT));
    inputManager.addMapping("CharLeft", new KeyTrigger(KeyInput.KEY_A));
    inputManager.addMapping("CharRight", new KeyTrigger(KeyInput.KEY_D));
    inputManager.addMapping("CharUp", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("CharDown", new KeyTrigger(KeyInput.KEY_S));
    inputManager.addMapping("CharJump", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addListener(this, "run");
    inputManager.addListener(this, "CharLeft");
    inputManager.addListener(this, "CharRight");
    inputManager.addListener(this, "CharUp");
    inputManager.addListener(this, "CharDown");
    inputManager.addListener(this, "CharJump");
    }

public void onAction(String binding, boolean value, float tpf) {
    if (binding.equals("CharLeft")) {
        if (value) {
            left = true;
        } else {
            left = false;
        }
    } else if (binding.equals("CharRight")) {
        if (value) {
            right = true;
        } else {
            right = false;
        }
    } else if (binding.equals("CharUp")) {
        if (value) {
            up = true;
        } else {
            up = false;
        }
    } else if (binding.equals("CharDown")) {
        if (value) {
            down = true;
        } else {
            down = false;
        }
    } else if (binding.equals("run")) {
        if (value) {
            run = true;
        } else {
            run = false;
        }
    } else if (binding.equals("CharJump")) {
        charControl.jump();
    }
     else if (binding.equals("1")) {
        rootNode.detachChild(monet);
    }
    }

@Override
public void simpleUpdate(float tpf) {
Vector3f camDir = cam.getDirection().clone().multLocal(speed);
Vector3f camLeft = cam.getLeft().clone().multLocal(speed);
camDir.y = 0;
camLeft.y = 0;
walkDirection.set(0, 0, 0);
if (left) {
walkDirection.addLocal(camLeft);
}
if (right) {
walkDirection.addLocal(camLeft.negate());
}
if (up) {
walkDirection.addLocal(camDir);
}
if (down) {
walkDirection.addLocal(camDir.negate());
}
if (!charControl.isOnGround()) {
airTime = airTime + tpf;
} else {
airTime = 0;
}
if (run){
speed = 3f;
move = “Run”;
} else {
speed = 1f;
move = “Walk”;
}
if (walkDirection.length() == 0) {
if (!“Idle”.equals(animationChannel.getAnimationName())) {
animationChannel.setAnim(“Idle”, 1f);
}
} else {
charControl.setViewDirection(walkDirection);
if (airTime > 5.8f) {
if (!“Jumping”.equals(animationChannel.getAnimationName())) {
animationChannel.setAnim(“Jumping”);
}
} else if (!move.equals(animationChannel.getAnimationName())) {
animationChannel.setAnim(move, 0.1f);
}
}
charControl.setWalkDirection(walkDirection);
gameLogic();
}

private void setupAnimationController() {
    animationControl = model.getControl(AnimControl.class);
    animationControl.addListener(this);
    animationChannel = animationControl.createChannel();
     }

public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
}

public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}

private PhysicsSpace getPhysicsSpace() {
return PhysicsSpace.getPhysicsSpace();
}

private void gameLogic(){
    //еще не разобрался что к чему
}        

        
private void createMonet() {
    //movable monet
    for (int i = 0; i < 5; i++) {
        monet = (Node) assetManager.loadModel("Models/moneta/Moneda.j3o");
        monet.scale(0.25f);
      //monet.setLocalTranslation(Math.abs(random.nextInt(30)), 1, Math.abs(random.nextInt(50)));
        monet.setLocalTranslation(i, 0, i);
        monet.setShadowMode(RenderQueue.ShadowMode.Cast);
        rootNode.attachChild(monet);
    }
}

private void createBall(PhysicsSpace space) {
    //материал и текстура для сфер   
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
//movable spheres
    for (int i = 0; i < 5; i++) {
        Sphere sphere = new Sphere(16, 16, .5f);
        Geometry ballGeometry = new Geometry("Soccer ball", sphere);
        ballGeometry.setMaterial(material);
        ballGeometry.setLocalTranslation(i, 2, -3);
        //RigidBodyControl automatically uses Sphere collision shapes when attached to single geometry with sphere mesh
        ballGeometry.addControl(new RigidBodyControl(.001f));
        ballGeometry.getControl(RigidBodyControl.class).setRestitution(1);
        ballGeometry.setShadowMode(RenderQueue.ShadowMode.Cast);
        rootNode.attachChild(ballGeometry);
        space.add(ballGeometry);
    }
}

}
[/java]

it is impossible to deal with
1 - animation jump (JumpStart, Jumping, JumpEnd) - that there was a sequence without repetitions while holding the button
Jumping - only if you will fall down from the mountain like

2 - just want to add a field to the stage where there will be other parameters (speed, gravity)

3 - the interaction of the player models with other models
! such as a coin, that would be at the touch of it was removed from the scene
! also provided that the character is at a certain distance, and pressing action takes place, such as a coin disappears.

partly on the work of the interface (it I have not delved)
4 - When you press the left mouse button the object was in Target, and further actions took place in his direction

5 - switching between models (management)
for example I come up to the car, and then click E has already run a car (which has its own controlCharapter)

if help is not difficult to deal with these paragraphs

and if someone does not wish, tell your skype or icq for communication and helping me

оригинал текста без translate.google.com.ua :
изучая материалы пришел к такой вот форме кода.

не получается разобраться с
1- анимацией прыжка (JumpStart, Jumping, JumpEnd ) - что бы была последовательность и без повторов при зажатой кнопке
Jumping - только если будет падать с горы например

2- так же хочу добавить области на сцене в которых будут другие параметры ( скорость, гравитация )

3- взаимодействие модели игрока с другими моделями,
!например монета, что бы при касании она убиралась с сцены
!так же, при условии что персонаж стоит на определенном расстоянии и нажатии клавиши происходило действие, например монета пропадала.

далее частично работа с интерфейсом (в нее я еще не вникал)
4- при нажатии левой кнопки мыши предмет был в таргете и далее действия происходили по направлению к нему

5- переключение между моделями (управление)
например я подхожу к автомобилю, нажимаю E и далее управляю уже автомобилем (у которого свой controlCharapter)

если не сложно помогите разобраться с этими пунктами

и если кому не жаль, сообщите свой скайп или icq для связи и помощи мне