From: Andrew W. <an...@ph...> - 2004-05-16 03:37:24
|
On Sat, 15 May 2004 21:36:07 -0400, Bruce Sherwood wrote: >I don't understand this syntax. If pos2 and pos1 are intended to stand >for something like box1.pos and box2.pos, positions of VPython objects, >then what you need is mag(pos2-pos1), not abs(pos2-pos1). > >> On Fri, 2004-05-14 at 09:28, Andrew Williams wrote: >>> >>>if abs(pos2 - pos1) < 0.01: >>> handle_collision() The 'abs' builtin does return the magnitude of a vector - I checked before posting the email. It doesn't work for tuples, only visual's vector types. I'd actually forgotten about the 'mag' function, but I assume that _would_ work for tuples, as it'd auto-convert them into vectors like all the other visual functions. Andrew |