# Moving Objects with Python

I am a big fan of disc golf. If you have never played it I recommend it. So when I downloaded Blender last week, I started making a disc golf game. Modelling was easy to figure out, but I was wondering what are the key ingredients to making an object move (by simple physics equations) through Python (not the Logic blocks)? Can someone point me to a good tutorial of manipulating an objects xyz coordinates?

I am trying to make the disc fly! Frisbees will naturally curve to the left when thrown, so I need to have two equations: one for the height and one for the curve (I’m not asking anyone to come up with these equations - just giving you a better idea of what I’m trying to do).

Or am I wrong for not using the logic bricks? Would it make it a lot easier to program the flight of an object with logic bricks? Again, any tutorials you may have found on maybe throwing a grenade or making a projectile be shot would be great.

you will have to use logic bricks

they are the only way to get input or events [object collides with something, and stuff], and they are the only way to do many things [play an animation on your object, make it go away, …] and they are the only way to make your python script run in the game engine

see what you can do with logic bricks, then do what isn’t possible in python. Start figuring out python in the game engine by looking for scripts in this forum.

I’ve got the movement thing figured out, but how might I make the disc curve as it went through the air (it needs to ‘break’ left)?

force in a motion actuator
not actually having the object spinning [have a child object play an ipo to rotate] then you can use force on a local axis

Python should be used when Logic Bricks don’t do what you need OR where Logic Bricks are too complicated (Complex Logic Brick riggings can be confusing and run slower than Python.)

You have LOTS of options when it comes to moving objects:

• A motion actuator can add force, acceleration, velocity or displacement
• A python script can control each aspect of a motion actuator
• A Python script can apply an impulse (acceleration) to an object
• A Python script can set the position of an object