[Help]Only load close objectcs

Hello everybody,

Sorry for my bad english >.<

I don't know exactly how to explain this, here we go:

I made a tiled map (2048), and when i turn my camera around this scenario i get a low FPS, sometimes 8fps or 3fps. I think it's cause i have a lot of objects.
Then i think i need to load only close objects (assets) of the camera, but i don't know how to do it. I'm work on it since yesterday and don't figure out nothing.

Example:
I wanna load only objects that are close the camera, maybe 200 pixels of distance.

How can i do it?

Thanks since now.

Well are the boundings correctly done and do you use cullhint.dynamic?
That should not render anything outside the visible cone. (Wich depending on your camera setting (i assume a rts/diablo one?) could already do enough optimisazion.

1 Like
@Empire Phoenix said: Well are the boundings correctly done and do you use cullhint.dynamic? That should not render anything outside the visible cone. (Wich depending on your camera setting (i assume a rts/diablo one?) could already do enough optimisazion.

The boundings are fine. I don’t know what is cullhint.dynamic (if u can explain >.<).

Render everything, has no limited visible (don't know why ._.), i start at position (10, 10, z) and when i turn around the camera i see what is in position (2000, 2000, z).

Can you give me a code example? (i’m using 1st person camera, like a doom 3 or counter strike camera)

u want as low an object count as possible, look at batching

1 Like

Arrr, i can’t deal with it,

[video]http://www.youtube.com/watch?v=7rMqYt5C-BI[/video]

Here is my code:

[java]
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;

public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);

    viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f));
    flyCam.setMoveSpeed(100);
    setUpKeys();
    setUpLight();

    
    sceneModel = assetManager.loadModel("Textures/Terreno/FirstWorld.j3o");
    sceneModel.setLocalScale(2f);

    CollisionShape sceneShape =
            CollisionShapeFactory.createMeshShape((Node) sceneModel);

    landscape = new RigidBodyControl(sceneShape, 0);
    sceneModel.addControl(landscape);

    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
    player = new CharacterControl(capsuleShape, 0.05f);
    player.setJumpSpeed(20);
    player.setFallSpeed(30);
    player.setGravity(30);
    player.setPhysicsLocation(new Vector3f(0, 10, 0));

    rootNode.attachChild(sceneModel);

    bulletAppState.getPhysicsSpace().add(landscape);
    bulletAppState.getPhysicsSpace().add(player);
    
}[/java]

*This terrain was made on JME terrain editor.

I’m so… no words…

[java]cam.setFrustumFar(300);[/java]

Problem resolved…

Thanks for everybody who help me to figure it out. :lol: