3d Model Scaling With Camera
Posted
by
spasarto
on Game Development
See other posts from Game Development
or by spasarto
Published on 2011-11-23T22:07:51Z
Indexed on
2011/11/24
2:22 UTC
Read the original article
Hit count: 272
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 );
© Game Development or respective owner