i'm trying to build a tendril object using the physics system. source
code is attached. it's built up using a couple of cubes joined together
with ball joints, the top is fixed. when i give it a kick, i kick one of
the cubes, which makes the whole tendril move. i would like the motion
to damp very rapidly. when it gets a kick it moves, but after a second
it should stand still again. i can't seem to achieve this. any help
would be appreciated.
best,
gabor
(require scheme/class)
(clear)
(random-seed 0)
(define tendril%
(class object%
(init part-count_
part-size_)
(field
(part-count part-count_)
(part-size part-size_))
(define parts '())
(define (initialise)
(for ([i (in-range part-count)])
(let ([obj (build-cube)])
(with-primitive obj
(translate (vector 0 (+ (* -1 i part-size) (/ part-size
2)) 0))
(scale (vector .1 (+ part-size .1) .1)))
(active-box obj)
(if (zero? i)
(build-fixedjoint obj)
(let ([j (build-balljoint obj (car parts)
(vector 0 (* -1 part-size (sub1 i))
0))])
(joint-param j "Bounce" 0)))
(set! parts (cons obj parts)))))
(define/public (kick-tendril v)
(kick (list-ref parts (random (length parts))) v))
(initialise)
(super-new)))
(define tendril (make-object tendril% 10 .5))
(send tendril kick-tendril (vmul (crndvec) 10))