; MeshHeight Example ; ------------------ ; MeshHeight returns the height (y size) of a mesh's geometry. ; It measures the MESH data, so ScaleMesh changes it while ; ScaleEntity would not. Hold [ or ] to squash and stretch the drum ; and watch the height readout follow. Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-4 light=CreateLight() RotateEntity light,30,40,0 ; Load a model and fit it into a 2x2x2 box to start from known sizes drum=LoadMesh("media/oil-drum/oildrum.3ds") FitMesh drum,-1,-1,-1,2,2,2 While Not KeyDown(1) ; [ / ] rescale the mesh along y - the height readout follows If KeyDown(26) Then ScaleMesh drum,1,0.98,1 If KeyDown(27) Then ScaleMesh drum,1,1.02,1 TurnEntity drum,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"[ / ] : squash / stretch height Arrow keys: move camera Esc: exit" Text 0,20,"MeshHeight(drum) = "+MeshHeight(drum) Text 0,40,"Width "+MeshWidth(drum)+" Depth "+MeshDepth(drum) Flip Wend End