> i added a new function that removes an object from the physics system.
i renamed the function to (physics-remove), because i realized that it
shadows the plt scheme list remove function.

what's more, my last example was not very helpful, because when you
destroy an object, it is removed from the physics system anyway. i
attached another example when a cube is added and removed as you press
the left mouse button.

best,
gabor

(clear)

(collisions 1)

(ground-plane #(.1 .9 0) -1)

(define box (build-cube))

(define last-mb #f)
(define active #f)

(define (animate)
    (when (and (mouse-button 1) (not last-mb))
        (if active
            (begin
                (set! active #f)
                (physics-remove box))
            (begin
                (set! active #t)
                (active-box box))))
    (set! last-mb (mouse-button 1)))

(every-frame (animate))

Reply via email to