Panda Manual > Your First Model

Your First Model

From nothing to a spinning crate in your own BambooBasic program, in about ten minutes. Then a second, slightly bigger model, to try the tools that matter most.


Part 1: a crate
  1. Start Panda (IDE: Tools > Panda Modeller...). You get four empty views.
  2. Make a box. On the Model tab click Box. In the Front view (top left), press the left button and drag out a square, then let go. The box appears in all four views, selected (red). Its depth is the same as its shorter side, so a square makes a cube.
    Didn't work? Shapes are drawn in the flat views (Front, Left, Top), not the 3D one.
  3. Look at it. In the 3D view (bottom right) hold the right button and drag to turn round it; roll the wheel to zoom. Press Home if you lose it.
  4. Make it the right size. Tools > Fit Model into the -1..1 Box makes it 2 units across, centred: the size the BambooBasic examples expect.
  5. Give it a texture. Go to the Materials tab and click Load... under Texture. Pick examples\BambooRuntime\26 - 3D in 2D\Media\crate.png. The 3D view shows the crate. A box has every side mapped to the whole picture already, so there's nothing else to do.
  6. Save your work. File > Save (Ctrl+S) and call it crate. That's a .pan file: Panda's own, with everything in it, texture included. Always keep the .pan; it's what you come back to.
  7. Export it for BambooBasic. File > Export As... (Ctrl+E): Click Export. Panda writes crate.bb3d, and the texture beside it (if it isn't there already).
  8. Draw it. In the IDE open examples\BambooRuntime\26 - 3D in 2D\MeshLoad.bam. Find Media/cube.bb3d and change it to Media/crate.bb3d. Build and run: that's your crate, spinning.

Change something in Panda, then File > Export Again (Ctrl+Shift+E) and run the program again - that's the everyday round trip.


The same crate as code

No file to load at all:

  1. File > Export As..., Format .bam - BambooBasic code, Model name Crate, save it next to your program. Leave Default Model Controls ticked.
  2. In your program:
Import "BBRuntime64.decls"
Include "Crate.bam"

Function Main()
    b2dGraphics(800, 600, 1)                    ; 1 = in a window
    Crate_Build()
    Crate_SetView(400.0, 300.0, 600.0, 0.5, 50.0)
    Crate_Texture = b2dLoadImage("crate.png")   ; the texture file next to your program
    Local spin:Double = 0.0
    While inpIsKeyHit(27) = False               ; until Esc
        sysUpdateEvents()
        spin = spin + 1.0
        b2dCls()
        Crate_Draw(0.0, 0.0, 4.0, spin, 20.0, 0.0, 1.0)
        b2dFlip()
    Wend
    Return 0
EndFunction

Leave out the Crate_Texture line and it's drawn in its colours instead. Everything the code export can do is in BambooBasic Code Export.


Part 2: a little house, trying the main tools
  1. File > New. Make a Box in the Front view, a bit wider than tall.
  2. Select the top. Click Select. In the Model tab's Select box choose Face. In the 3D view, click the box's top face. It turns red.
  3. Extrude a roof. Click Extrude, then drag up in the Front view. The top is pulled up with new walls round it.
  4. Make it pointed. Click Scale. Untick the Y axis button (Options box) so only width and depth change, and drag left in the 3D view: the top shrinks to a ridge. (Or choose Vertex select, pick the top four vertices and use Vertex > Weld Together for a point.) Tick Y again afterwards.
  5. Colour it. Materials tab: Add... a red. Select the roof faces (Shift adds) and click Apply to Selection. Add... a cream, select the walls, Apply to Selection. Set the 3D view's drawing to Flat (the second list on its top bar) to see the colours.
  6. Add a door. Make a Plane in the Front view over the front wall and give it a brown. New shapes are made through the middle of the model, so the door starts inside the house: with Move, drag it in the Left view towards the front (in the Left view the front is to the right) until it's just in front of the wall.
  7. Undo anything you don't like with Ctrl+Z. Save.

Next: Building Models explains every tool properly, and Pose Frames or Joints make it move.


< The Window   |   Contents   |   Building Models >