Hello, I have what should be a basic math question, but I keep messing it up.
How do I code an equation so that when I have an object facing an arbitrary vector, pressing a key will make it move forwards in that direction? (I understand all the key-based setup, it's just the equation for moving in the arbitrary vector direction that's got me stuck) right now i can make something move up and down, or left and right, but if I want to rotate a triangle, then move it so that the 'tip' always points in the direction it's going to move, I get stuck. the thing I have which doesn't work is something like _____________________ vector = [0 0 0] def specialKey(key,x,y): if key == 'up': vector[0] = vector[0] + 1 _______________________ which I assume should be more like -------------------------------- vector = [0 0 0] def specialKey(key,x,y): if key == 'up': vector[0] = vector[0] * math.cos(something???)+ 1 vector[2] = vector[2] * math.sin(something??)+1 ---------------------------------- Any help would be greatly appreciated! ty, Mike _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor