Re: conditionals
Mithila Patwardhan <[email protected]> Sat, 14 May 2005 16:49:45 -0400
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
hi, what i've discovered is that you can't compare floats. you must have ints in the if statement. if you make loc an int and the other constant vector int - it should work. - mithila Cavan Fyans wrote: >hi, > >can anyone help me out here....in the code (linked at the bottom) im >trying to run a conditional (if) statement in the iterate method of >'Indicator'. I have been trying for a while now and cannot get it to >compare vectors to the desired result. All i want to do is compare >'loc' (a vector) the location of the object with another vector (9.5, >2, 1) and when the object moves past this point for it to stop moving >the iterat emethod is as follows: > >+ to iterate: > loc = self get-location. > if loc > (9.5, 2, 1): self set-velocity to (0, 0, 0). > #print loc. > >now this doesnt work, and i have tried other methods to do a similar >thing....such as having the second vector as a variable too and trying >'if loc - vectorA = vectorB' or 'if loc - vectorA = (0, 0, >0)'......this is more complicated as if you let it print out the >values of 'loc' at each iteration you will see it never lands on (9.5, >2, 1)....but i ammended the values so it is accurate and it still >makes no difference. > >im sure there must be some one line answer...and its just a simple >oversight by me, but any help on how i can go about this would be >great! > >Thanks. >Cav. >Code: http://bb.1asphost.com/CavSymbiotick/Project.txt > >_______________________________________________ >breve mailing list >[email protected] >http://lists.spiderland.org/mailman/listinfo/breve > > _______________________________________________ breve mailing list [email protected] http://lists.spiderland.org/mailman/listinfo/breve