Game Development Reference
In-Depth Information
Figure 3-25. Translating an object on z axis
Scaling an Object
Here I will cover scaling objects. First add the following statement under the entry for the
m_CubePositionDelta variable that you added previously.
private Vector3 m_CubeScale = new Vector3(4,1,1);
The m_CubeScale variable represents the amount to scale the object in the x, y, and z directions. In this
example, the cube scales by four times the normal size in the local x axis direction and scales by the
normal size, which is 1, in the y and z directions.
The following statement sets the scale for the cube. Type this into the onDrawFrame() function after
the previous code you have added.
// Set Scale
m_Cube.m_Orientation.SetScale(m_CubeScale);
Run the program, and you should see what is in Figure 3-26 .
 
Search WWH ::




Custom Search