Ming
Ming

Reputation: 215

How to find the nearest patch in 3D model?

How can a turtle find the nearest patch in 3D model? For 2D model, the code should be like this.

    let nearest min-one-of (patches with [pcolor = green] ) [distance myself] ;

However, I tried to use distancexyz, and it does not work and it requires x, y and z coordinators. I am not sure how to get those coordinators of a turtle. Thanks.

Upvotes: 0

Views: 85

Answers (2)

Seth Tisue
Seth Tisue

Reputation: 30453

The same code should work in 3D as in 2D.

Upvotes: 1

Bryan Head
Bryan Head

Reputation: 12580

distancexyz takes coordinates as arguments, not an agent (patches are agents). You want distance, as in distance nearest.

Upvotes: 1

Related Questions