Originally Posted by
psycore
A:add_hook("enter_freeze","disableGhost",function() set_ghost(0) end)
C: The distance from Tori's head to Uke's Joints. Returns an array.function getDistance()
distance={}
hPos = get_body_info(0,0).pos
for j=0, 19 do
jPos = get_joint_pos2(1, j)
distance[j] = math.sqrt(math.pow(hPos.x-jPos.x,2)+math.pow(hPos.y-jPos.y,2)+math.pow(hPos.z-jPos.z,2))
end
return distance
end
As far as I know it's impossible to get the exact momentum. You could try to get the acceleration with a = 2s/tē for very short t. You have to figure out the mass somehow else.
e: My bad, momentum is m*v, not m*a. For v use get_body_linear_vel() and get_body_angular_vel(). Still the Problem with the mass.
I could theoretically use radius*vel to get momentum, the thing about this script is it's entirely fuzzy logic, so if the input isn't exact I'll still get a good result. At the moment I'm simply using velocity as input and it will do, lots of debugging to do to get this to work, I've had to re factor all 400 lines of code three times now due to LUA's dodgy object orientation methods.
[EDIT] Grah, having a problem I'm not sure how to resolve.
...
function self:gameTurn(frames)
...
run_frames(frames)
end
...
add_hook("enter_freeze","play a turn",h:gameTurn(10))
...
This doesn't appear to be working, it runs 10 frames once at the start of a game and never runs again, however I need this to run every turn. It also doesn't run if I press space-bar to advance the turn, it's as if the hook isn't working.
[EDIT] YoYo fixed that problem, never-mind, currently working with the programme to fine tune it.
Last edited by Vox; May 29, 2011 at 10:52 PM.