Hi , I’ve a simple problem, I’m working on a game in first person and unfortunately I note that when I load too mach object like for example tree, the player movement suffer a deceleration and the movement is slow and with click … this ruin the gameplay
In particular this is the code relative
[java]
@Override
public void simpleInitApp(){
//set up flycam
flyCam.setEnabled(true);
initPhysics();
// loadCharacter();
initSky();
initTerrain();
initLight();
initBULLETS();
setUpKeys();
// createSector();
initMaterial();
setUpKeys();
initCrossHairs();
managementPlayer();
loadTree();
// managementEnemy();
// startAi();
}
//method
public void loadTree(){
int x =-300;
int z = 300;
for(int i=0; i<100; i++){
ObjectStreet object = new ObjectStreet(assetManager, rootNode , bulletAppState, x,z);
// x+=10;
z-=10;
}
}
//class
public class ObjectStreet {
CharacterControl characterTree;
Spatial tree;
float x;
float z;
public ObjectStreet(AssetManager assetManager,Node rootNode, BulletAppState bullet,float x, float z){
this.x= x;
this.z= z;
CapsuleCollisionShape capsule = new CapsuleCollisionShape(1.4f, 0.5f);
//peso
characterTree = new CharacterControl(capsule,50f);
tree = (Spatial) assetManager.loadModel("Models/Tree/Tree.mesh.xml");
tree.setLocalScale(10,10,10);
tree.addControl(characterTree);
characterTree.setPhysicsLocation(new Vector3f(this.x, 0,this.z) );
bullet.getPhysicsSpace().add(tree);
rootNode.attachChild(tree);
}
}
[/java]
Nothing of strange, there is something of graphics(for optimization) that escapse me?? How can remedy??
thanks in advance