|
From: | Dimitris Papavasiliou |
Subject: | Re: [Billiards-devel] Programming experiments with Billiards |
Date: | Tue, 19 Jan 2010 13:53:09 +0200 |
Ok, I think I found the "offending" code in game.lua, lines 177-178. Now
I can set the observer longitude and latitude.
I also managed to set the observer's azimuth with this code
local oldnewshot = billiards.looking.newshot
billiards.looking.newshot = function ()
-- First call the old function to setup the defaultoldnewshot()
-- behavior we don't want to change.
bodies.observer.azimuth = math.rad(90)
-- Now change what we don't like.
bodies.observer.elevation = math.rad(45)
bodies.observer.longitude = bodies.cueball.position[1]end
bodies.observer.latitude = bodies.cueball.position[2]
Ok, I tried to implement the transition between looking and aiming mode
with the following:
if options.experiment2 then
billiards.looking.experiment2 = function ()
for i, ball in ipairs (bodies.balls) do
local x = ball.position[1]
local y = ball.position[2]
if i == 1 then
print (string.format ("White ball position: (%f, %f)", x,
y))
elseif i == 2 then
print (string.format ("Black ball position: (%f, %f)", x,
y))
end
end
print ("Entering aiming mode...")
bodies.observer.islooking = false
bodies.observer.isaiming = true
end
billiards.aiming.experiment2 = function ()
print ("Stepping into function 'billiards.aiming.experiment2'")
joints.arm.motor = {arm_velocity, 1000}
end
end
but it doesn't work. The console output shows the text:
"Stepping into function 'billiards.aiming.experiment2'", but the balls
don't move.
Can you help me with this?
[Prev in Thread] | Current Thread | [Next in Thread] |