# IPO python

Well im playing around with the Game engine trying to get a few odd things to work. As i post this im also searching for tutorials/examples on the net but ive been at it all day and havent found anything to fit my problem.

my situation is i want a simple spring. I have the spring modeled, and setup so that in 24 frames it goes from normal to about 50% compressed. I have a very simple Wheel next to it that can follow the spring using ipos again. But with Python IPO’s i wanted the wheel LocZ, to effect the Spring ScaleZ…so whenever that tire went up the spring would follow by reacting to a math equation like the one below

ob(“spring”).ScaleZ - ob(“tire”).LocZ

but when i enter that into the ipo python line it doesnt want to work…

so then i saw that you can use a external python script to allow more than one expression, which for what i need will be used later, but i want a basic understanding before i dive further. but im failing to grasp for whatever reason how to do it in a external script. And am looking for tutorials on that as well, just for info i guess, it will be linked to the vehicle suspension for the game so any help to python on that would be nice as well lol

thanx

ok well i got a few formulas to work a basic one that allows me to input the max power and i can adjust that and it will adjust a linear curve in a circle, basic idea is rpm gauge and movement of car, so at certain rpm give this much power…but i have a problem

when in the game, a key movement is linked to a python script, it evaluates the script and then the script is what moves the object…

the object moves in a 180 degree rotation, or 3.14 radians or what ever unit blender uses…(my math works) over 24 frames. So at full rotation it would be at max power, half rotation half power and zero rotation at 0 power and so on for every frame inbetween…

when i run the script from the text window. and have it print to the console it gives me correct values…but heres my problem. when i run the game and im in the first frame (zero rotation = zero power), and i hit a key, the object rotates but i get zero power now matter what rotation the object is at why???..in the console it works fine and the value is correct why is it not reading it during the game…

but if i start the game with say full power or at frame 24, the power is read as full with no inbetween like it should…why is that? why is the console telling me correct numbers at a given frame but the game isnt reading it correctly?

if need be i can post my code