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 have a very simple 3D maze program that uses a first person camera to navigate the maze. I'm trying to scale the blocks that make up the maze walls and floor so the corridors seem more roomy to the camera. Every time I scale the model, the camera seems to scale with it, and the corridors always stay the same width.

I've tried apply the scale to the model in the content pipe (setting the scale property of the model in the properties window in VS). I've also tried to apply the scale using Matrix.CreateScale(float) using the Scale-Rotate-Transform order with the same result. If I leave the camera speed the same, the camera moves slower, so I know it's traversing a larger distance, but the world doesn't look larger; the camera just seems slower.

I'm not sure what part of the code to include since I don't know if it is an issue with my model, camera, or something else. Any hints at what I'm doing wrong?

Camera:

Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, _device.Viewport.AspectRatio, 1.0f, 1000.0f );

Matrix camRotMatrix = Matrix.CreateRotationX( _cameraPitch ) * Matrix.CreateRotationY( _cameraYaw );
Vector3 transCamRef = Vector3.Transform( _cameraForward, camRotMatrix );
_cameraTarget = transCamRef + CameraPosition;
Vector3 camRotUpVector = Vector3.Transform( _cameraUpVector, camRotMatrix );
View = Matrix.CreateLookAt( CameraPosition, _cameraTarget, camRotUpVector );

Model:

World = Matrix.CreateTranslation( Position );
share|improve this question

1 Answer 1

up vote 2 down vote accepted

How do you set the height of the camera above the floor? Is this height getting scaled along with the model, perhaps? To make the space appear larger, the camera should be placed down closer to the floor.

If you have fog or a similar depth-based effect in your game, pulling in the distance on that can also be a good way to give a sense of scale.

share|improve this answer
    
Hey Nathan, that makes sense for the height, but what about the camera width? Lowering the camera helps the height issue, but the width of the corridor still remains the same. As for setting the height, I use a simple "gravity" effect to pull the BoundingBox of the camera down until it intersects the floor. I set the bounding box by adding some padding (current 5f) to the Camera's current position. –  spasarto Nov 24 '11 at 3:12
    
Well, it's in the nature of projective geometry that if you just scale up the entire world, you're not going to see a visible difference. Everything will be further away but it will still project to the same point on the screen. This is why you need additional cues like fog, texture scale, camera height etc. to get the right sense of space. You might try scaling the mesh UVs by the same factor by which you scale the positions; depending on how it's textured that might work. Or you might try scaling only horizontally, or only vertically. –  Nathan Reed Nov 24 '11 at 3:21

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.