/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// // _ // |_) _. | | // |_) (_| | | // // /////////////////////////////////////////////////////////////////////////// // CONFIGURATION // /////////////////////////////////////////////////////////////////////////// // This represents the distance from the ball that an // avatar may hit the ball. Keep in mind, this is // measured roughly from the avatar's groin. Be generous. // This is also related to response time, a ball that // is hurling towards you may be hard to hit and you // would also have to take into account the region // dilation time which is implicit in this value and // not calculated on the fly. float HIT_DISTANCE = 2; /////////////////////////////////////////////////////////////////////////// // END CONFIGURATION // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // INTERNALS // /////////////////////////////////////////////////////////////////////////// string bidM; string bidH; integer comChannelM; integer comChannelH; vector origin; vector target; float V0; float dΔ; float valSin; list cDest; default { state_entry() { bidM = llList2String(llParseString2List(llGetScriptName(), [" vs "], []), 0); bidH = llList2String(llParseString2List(llGetScriptName(), [" vs "], []), 1); list alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; integer itra; integer mhash; for(itra=0, mhash=0; itra HIT_DISTANCE) return; cDest = llCSV2List(message); target.x = llList2Float(cDest, 0); target.y = llList2Float(cDest, 1); target.z = llList2Float(cDest, 2); V0=llList2Float(cDest,3); dΔ=llVecDist(,); valSin = 9.81*dΔ/llPow(V0, 2); if(valSin < -1 || valSin > 1) valSin = 9.81/llPow(V0, 2); if(valSin < -1 || valSin > 1) return; llSetVelocity(llVecNorm(<1,0,0>*llRotBetween(<1,0,0>,llVecNorm()))*V0, FALSE); } }