The following code, will launch the named object [K] Nova
at the avatar owning the object using the low theta angle and with a velocity that is half of the current region FPS. The calibration of the speed to the region FPS is meant to avoid the projectile going through the target.
/////////////////////////////////////////////////////////////////////////// // 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. // /////////////////////////////////////////////////////////////////////////// fireNova(key targetKey) { float initialVelocity = llGetRegionFPS()/2.0; vector target = llList2Vector(llGetObjectDetails(targetKey, [OBJECT_POS]), 0); vector origin = llGetPos(); float distanceDelta=llVecDist(<target.x,target.y,0>,<origin.x,origin.y,0>); float valSin = 9.81*distanceDelta/llPow(initialVelocity, 2); if(valSin < -1 || valSin > 1) return; rotation rotationDelta = llRotBetween(<1,0,0>,llVecNorm(<target.x-origin.x,target.y-origin.y, distanceDelta*llTan((RAD_TO_DEG*llAsin(valSin)/2) * DEG_TO_RAD) + target.z-origin.z>)); llRezObject("[K] Nova", llGetLocalPos(), llVecNorm(<1,0,0>*rotationDelta)*initialVelocity, rotationDelta, 0); } default { touch_start(integer num) { fireNova(llGetOwner()); } }