Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a first-person game, and I've gotten the camera done (modified version of Lloyd Goodall's code), but whenever I scale an object, it doesn't appear bigger, but the speed of movement seems to have slowed down (of course, I know that this is because of the size, but I'd rather want to see the objects scaled up). Here is my code:

    Prism rect = new Prism(new Vector3f(1f, 1f, 1f), new Vector3f(1,1,1));
    try {
        rect.setTextures(new TextureArray(
            tl.loadTexture("default_dirt.png")).getTextures());
    } catch(Exception e) {
        e.printStackTrace();
        Errors.exit(Errors.EXCEPTION);;
    }

    Camera camera = new Camera(0,0,0);
    float dx;
    float dy;
    float dt;
    float sensitivity = 0.07f;
    float speed = 0.07f;
    // Generate the frames
    Mouse.setGrabbed(true);
    while (!Display.isCloseRequested() && !input.isKeyDown(input.ESC)) {
        dt = getDelta()/10;
        dx = Mouse.getDX();
        dy = Mouse.getDY();
        camera.incYaw(dx * sensitivity);
        camera.decPitch(dy * sensitivity);
        float dist = speed*dt;
        if(input.isKeyDown(input.JUMP)) {
            camera.up(dist);
        }
        if(input.isKeyDown(input.SNEAK)) {
            camera.down(dist);
        }
        if(input.isKeyDown(input.FORWARD)) {
            camera.forward(dist);
        }
        if(input.isKeyDown(input.BACK)) {
            camera.back(dist);
        }
        if(input.isKeyDown(input.LEFT)) {
            camera.left(dist);
        }
        if(input.isKeyDown(input.RIGHT)) {
            camera.right(dist);
        }
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glLoadIdentity();
        init3DGL(width, height);
        camera.look();
        rect.render();
        init2DGL(width, height);
        try {
            HotBar health =
                new HotBar(50, Tile.loadTexture("default_dirt.png"));
            health.render();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
        Display.update();
        Display.sync(30);
    }
    Display.destroy();

So I guess my question is: How do you keep a camera at a certain size?

share|improve this question
    
Can you think of a better title? It doesn't seem to sync with your question very well. And you can leave the tags out of the title. –  Byte56 May 16 '12 at 16:41
    
well, I don't exactly know what causes the problem, but I think this title is better –  MiJyn May 16 '12 at 16:56
1  
Well, the title is funnier, but doesn't describe your problem any better. There's no magic in computers, they only do what you tell them. –  Byte56 May 16 '12 at 17:32
add comment

1 Answer

up vote 3 down vote accepted

You don't show how you adjust the scale, so this is speculation.

If you scale an object relative to the camera (or its initial position) as center point, there will be no visual change but speed of motion will necessarily be slower relative to the scale of the object, so your results are to be expected.

To strengthen the impression of size, add other things which provide a scale to compare to, such as:

  • Other objects of known size.
  • Camera's height above the ground/horizon; it should be at a realistic eye level for your character/vehicle. To establish a ground plane, create a textured plane and possibly also a horizon gradient.
  • Distance fog or blur partly obscuring the object will convey largeness.
  • Texture features on surfaces; objects viewed at a distance should have finer/softer grain whereas close-up ones show detail. If you want to present an object at two different sizes and have it look different, don't just scale the texture coordinates up.
share|improve this answer
    
ok, I guess I'm talking about the camera's height. How would I do this? –  MiJyn May 16 '12 at 19:37
1  
You have to establish visual cues for the ground surface; the simplest way would be to render a textured ground plane. I recommend that you not focus on any one technique, but try to use as many different sorts of scale-dependent detail cues as you can in your scene. I've edited my answer with some more detail for the various techniques. –  Kevin Reid May 16 '12 at 20:37
    
Thanks, it works! –  MiJyn May 16 '12 at 20:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.