samedi 7 mars 2015

Have an object going to two different points in jmonkey


Vote count:

0




I have the Jaime model in jmonkey navigating to a specified point. This works great, what I can't get to work, is that once he arrives I want him to turn around and go back to the origin. I basically want the model to travel on a patrolling loop until hit by an object from the user, I have included the code below. I can't figure out what I need to do to get this to work:



private void setupCharacter(Node scene) {
//This creates my AI character
Node aiCharacter = (Node) assetManager.loadModel("Models/Jaime/Jaime.j3o");
AICharacterControl physicsCharacter = new AICharacterControl(0.3f, 2.5f, 8f);
aiCharacter.addControl(physicsCharacter);
bulletAppState.getPhysicsSpace().add(physicsCharacter);
aiCharacter.setLocalTranslation(0, 10, 0);
aiCharacter.setLocalScale(2f);
scene.attachChild(aiCharacter);
NavMeshNavigationControl navMesh = new NavMeshNavigationControl((Node)scene);
aiCharacter.addControl(navMesh);

if(aiCharacter.getLocalTranslation().getZ() == 0) {
navMesh.moveTo(new Vector3f(55, 10, -85));
}
else if (aiCharacter.getLocalTranslation().getZ() == -85){
navMesh.moveTo(new Vector3f(0, 10, 0));
}


}


asked 56 secs ago







Have an object going to two different points in jmonkey

Aucun commentaire:

Enregistrer un commentaire