-1
\$\begingroup\$

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?

\$\endgroup\$
3
  • \$\begingroup\$ 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. \$\endgroup\$
    – House
    May 16, 2012 at 16:41
  • \$\begingroup\$ well, I don't exactly know what causes the problem, but I think this title is better \$\endgroup\$
    – MiJyn
    May 16, 2012 at 16:56
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – House
    May 16, 2012 at 17:32

1 Answer 1

4
\$\begingroup\$

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.
\$\endgroup\$
2
  • \$\begingroup\$ ok, I guess I'm talking about the camera's height. How would I do this? \$\endgroup\$
    – MiJyn
    May 16, 2012 at 19:37
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – Kevin Reid
    May 16, 2012 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .