File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 30
30
(export ' (bt-collision-distance bt-collision-check))
31
31
32
32
(defun bt-make-model-from-body
33
- (b &key (csg (send b :csg )) (margin nil ))
33
+ (b &key (csg (send b :csg )) (margin 0 ))
34
34
" Make bullet model from body."
35
35
(let (m)
36
36
(cond ((assoc :sphere csg)
37
37
(setq m
38
38
(btmakespheremodel
39
- (* 1e-3 (user ::radius-of-sphere b)))
39
+ (* 1e-3 (+ ( user ::radius-of-sphere b) margin )))
40
40
))
41
41
((assoc :cube csg)
42
42
(setq m
43
43
(btmakeboxmodel
44
- (* 1e-3 (user ::x-of-cube b))
45
- (* 1e-3 (user ::y-of-cube b))
46
- (* 1e-3 (user ::z-of-cube b))
44
+ (* 1e-3 (+ ( user ::x-of-cube b) ( * margin 2 ) ))
45
+ (* 1e-3 (+ ( user ::y-of-cube b) ( * margin 2 ) ))
46
+ (* 1e-3 (+ ( user ::z-of-cube b) ( * margin 2 ) ))
47
47
)))
48
48
((assoc :cylinder csg)
49
49
(setq m
50
50
(btmakecylindermodel
51
- (* 1e-3 (user ::radius-of-cylinder b))
52
- (* 1e-3 (user ::height-of-cylinder b))
51
+ (* 1e-3 (+ ( user ::radius-of-cylinder b) margin ))
52
+ (* 1e-3 (+ ( user ::height-of-cylinder b) margin ))
53
53
)))
54
54
(t
55
55
(setq m
59
59
(mapcar #' (lambda (v) (send b :inverse-transform-vector v)) (send b :vertices ))))
60
60
(length (send b :vertices ))
61
61
))
62
+ (if (> margin 0 ) (btsetmargin m (* 1e-3 margin)))
62
63
))
63
- (when margin
64
- (btsetmargin m margin))
65
64
m)
66
65
)
67
66
Original file line number Diff line number Diff line change 27
27
(require :pqp )
28
28
(require :bullet )
29
29
30
+ ; ; set *collision-algorithm* from available libraries.
31
+ ; ; need to cehck if *collision-algorithm-pqp*/*collision-algorithm-bullet* exists, becuase it does not defined during compile time
30
32
(if (and (boundp ' *collision-algorithm-pqp*) (boundp ' *collision-algorithm-bullet*))
31
33
(defvar *collision-algorithm* (or *collision-algorithm-pqp* *collision-algorithm-bullet* )))
32
34
You can’t perform that action at this time.
0 commit comments