In order to change the scale of a model you can adjust the model meets the scene size or construct special effects, such as when a little sprite takes magical water, it suddenly becomes much stronger and bigger. In this recipe, you will learn how to change the model size at runtime.
Follow these steps to scale a 3D model:
1. Create a Windows Phone Game project named
ScaleModel
, changeGame1.cs
toScaleModelGame.cs
. Then add the model fileball.fbx
and font filegameFont.fle
to the content project.2. Declare the necessary variables. Add the following lines to the
ScaleModel
class field:// SpriteFont for showing the scale value on screen SpriteFont font; // Ball model Model modelBall; // Tree model world position Matrix worldBall = Matrix.Identity; // Camera Position Vector3 cameraPosition; // Camera view matrix Matrix view; // Camera projection matrix Matrix projection; // Scale factor float scale = 1; // The size the model will scale to float NewSize = 5;
3...