Hi i’ve made a map and imported it from blender.Now i need to give my units a heigh (an Y) to set them to right place,when i was testing stuff before making map i was using raycasting and a simple box geom,but now when i’ve imported pretty complex map i cant get ray to collide with map mesh,it collides to its box but not to mesh it self,what can i do?
private AnalogListener analogListener = new AnalogListener() {
if(playerChanel.getAnimationName().equalsIgnoreCase("Walk1HSw&Shield")){//Walk
player.move(cam.getDirection().getX()*tpf, 0,cam.getDirection().getZ()*tpf);
}
}
…
public void simpleUpdate(float tpf) {
origin= newVector3f(player.getWorldTranslation().getX(),player.getWorldTranslation().getY()+5,player.getWorldTranslation().getZ());
dir=new Vector3f (player.getWorldTranslation().getX(), player.getWorldTranslation().getY()-10,
player.getWorldTranslation().getZ()) ;
ray = new Ray(origin, dir);
//floor.collideWith(ray, results);
terrain.collideWith(ray, results);
if (results.getClosestCollision()!=null){
player.getLocalTranslation().setY(results.getClosestCollision().
getContactPoint().getY()+player.getChild(0).getLocalScale().getY()/2+player.getChild(0).getLocalScale().getY()/4);
System.out.println("ColPoint-"+results.getClosestCollision().getContactPoint()+
" whatColl"+results.getClosestCollision().getGeometry()+"
playersLocation"+player.getLocalTranslation());
}
}
- Node terrain = (Node)assetManager.loadModel(“Models/MapFirstTry/MapFirstTry.j3o”);
main problem is player crashes through textures of terrain from time to time in some places ,but some other places dont
here is the file