Heres my next script. this one simulates a force upon the selected object by using the RotX, RotZ and Size Y of an object, usually and empty, named Throw.
####################################
#
# Throw
# V 1.0
# By Justin 'MacBlender' MacArthur
#
####################################
#
#########################################
# User Vars
FPS = 25 # Frame Rate
Units = 2 # Number of Units per meter
starttime = 1 # Start frame
endtime = 100 # End frame
#########################################
# Script
import Blender
from Blender import Object, Ipo
import math
frame = 0
current = Blender.Get('curframe')
throw = Object.Get ('Throw')
tossx = throw.RotX
tossz = throw.RotZ
speed = (throw.SizeY*Units)/FPS
Vvel = math.sin(tossx)*speed
Hvel = math.cos(tossx)*speed
Obj = Object.GetSelected()[0]
name = "Throwipo" + str(Obj.getName())
ipo = Ipo.New('Object', name)
locxc = ipo.addCurve('LocX')
locyc = ipo.addCurve('LocY')
loczc = ipo.addCurve('LocZ')
for c in [locxc,locyc,loczc]:
c.setInterpolation('Linear')
c.setExtrapolation('Constant')
grav = FPS * FPS
for i in range(starttime,endtime):
H = math.sin(tossz)*Hvel
I = math.cos(tossz)*Hvel
G = (((9.81*Units)/grav)*frame)-Vvel
locxc.addBezier((frame,Obj.LocX))
locyc.addBezier((frame,Obj.LocY))
loczc.addBezier((frame,Obj.LocZ))
X = Obj.LocX-H
Y = Obj.LocY+I
Z = Obj.LocZ-G
Obj.setLocation(X, Y, Z)
frame = frame + 1
Blender.Set('curframe', current+frame)
Blender.Redraw()
print "Throw done."
it worked for me so i hope it works for you.
thanks to Theeth for his help with getting this script to work right.
get the script and a demo blend file here http://www.angelfire.com/anime4/nuvares/misc/Gravity.zip Thanks all