Dear list,<div><br></div><div>I tried to get through this myself but now I seem stuck. my issue is that I have a "world" (a green square) and I'd like to place objects in it (here represented by cubes). I don't want objects to land on each other and simple collision detection won't do because I want them to be clearly free-standing. My solution so far is to keep a list of all objects in my world with data like their type and position as well as the radius of free space they need around them, then check potential spots for nearby objects on this list. This, I realise, won't scale very well but it's the best I could come up with and for small worlds it should still be ok, especially as we will likely only need to run the whole thing once. This is what I have so far, it places one cube, adds it to the "myworld" list, then picks a spot and after that it *should* place a second cube, provided that spot isn't on top of the first one. Sadly it doesn't place anything ever and I can't see why. I don't get any more parser errors on this afer adding the lambda and it's not a simple matter of having inverted some logic, I think. I tried twiddling those bits.</div>
<div><br></div><div><div>(clear)</div><div><br></div><div><br></div><div>(with-state</div><div>    (colour (vector 0 1 0))</div><div>    (scale (vector 10 10 10))</div><div>    (build-plane))</div><div><br></div><div>(define-struct object (pos vel radius type) )</div>
<div><br></div><div><br></div><div>(define myworld (list ))</div><div><br></div><div><br></div><div>(define (place-cube pos)</div><div>    (with-state</div><div>        (set! myworld (cons (make-object pos (vector 0 0 0) 2 "cube") myworld))</div>
<div>        (translate pos)</div><div>        (build-cube)))</div><div><br></div><div><br></div><div>(place-cube (vector 0 0 .5))</div><div><br></div><div>(define (position-cube)</div><div>    (let ((spot (vector (* 4.5 (crndf)) (* 4.5 (crndf)) .5)))  </div>
<div>        (cond </div><div>            (not (andmap </div><div>                    (lambda (element) (> (vdist spot (object-pos element)) (object-radius element))) myworld))</div><div>            (place-cube spot))))</div>
<div><br></div><div>(position-cube)</div><div><br></div><div>The error has to be in the "cond" statement of "position-cube". Probably easy for hardcore schemers but some of the scheme logic is still hesitant to "click" with me.</div>
<div><br></div><div>Yours,</div><div>Kas.</div></div>