Watch out! I move fast! haha. This is the beginning of my Hear() function. It is short, but almost complete.
earPosition = getPosition(ears)
heardObjectPosition = getPosition(object)
xDiff = x2-x1
yDiff = y2-y1
radicand = math.pow(xDiff,2) + math.pow(yDiff,2)
distance = math.sqrt(radicand)
if distance == 0 then
setText(txt_hearing,"I hear something...")
setText(txt_hearing,"I hearn nothing")
I think that calculus course is coming in handy for checking if things are working. I have to check minimums and maximums to see if it works on either side of 0. I am not printing the distance yet.
I put the "squeeze" on the distance and here is how it checked out:
--At start distance is not equal to 0
--At start distance is greater than 0, which is how it should be.
-- At start distance is not less than 10
-- At start distance is greater than 10
--I think this might be a scale issue. I am going to move a box around in the environment to see the scale of the scene.
-- Turns out, at start, the distance between the ears and the monkey is roughly 130 units.
-- at start, distance is greater than 20 and less than 30
This doesn't seem right, as it was about 130 units in distance along the X-axis.
I am going to try to use getUnprojectedPoint() this should work better. I will save that for tomorrow. I am going to add some more sound effects to the project for the next upload.
Update: OOPS, that is not the distance forumula for 3d space. I need a "Z" axis in there.
Last edited by Tutorial Doctor (2014-03-03 19:37:05)