Skip to content
Jakob Flierl edited this page Jun 12, 2016 · 18 revisions

a Plane

p = Plane(0,1,0,0,100)   -- <x,y,z> up vector, mass, dim (for OpenGL preview)
p.col = "#ff0000"        -- red color
v:add(p)                 -- add it to the view

a Sphere

s = Sphere(1,10)           -- 1 diameter, 10 mass
s.pos = btVector3(0,10,0)  -- position the sphere 10 units above the plane
v:add(s)

a Camera

v.cam.pos  = btVector3(100,100,100)   -- cam position
v.cam.look = btVector3(0,5,0)         -- cam location

A sphere bounces on a plane surface

$ bpp -n 200 -f demo/basic/00-hello-cmdline.lua | gnuplot -e "set terminal dumb; plot for[col=3:3] '/dev/stdin' using 1:col title columnheader(col) with lines"

  10 **-----+------+------+------+------+------+------+------+------+-----++
     + **   +      +      +      +      +      +      +      +    Y ****** +
   9 ++  *                                                                ++
     |    *                                                                |
   8 ++   **                                                              ++
     |     *                                                               |
   7 ++     *                                                             ++
     |      *                                                              |
   6 ++      *                                                            ++
   5 ++      *         ******                                             ++
     |        *       **     **                                            |
   4 ++       *      *        **                                          ++
     |        **    **         *                                           |
   3 ++        *    *           *      *****                              ++
     |          *  *            **    **    **                             |
   2 ++         * **             *   **      **    *****                  ++
     |          * *              ** **        *  **    **                  |
   1 ++          **               **           ***       ** **            ++
     +      +    * +      +      +**    +      **     +   ** ***************
   0 ++-----+------+------+------+------+------+------+------+------+-----++
     0      20     40     60     80    100    120    140    160    180    200

Basic demos

See https://github.com/bullet-physics-playground/bpp/tree/master/demo#contents

Lua newbies

Clone this wiki locally