12p Posted July 30, 2014 Share Posted July 30, 2014 (edited) Ok guys look, I've got this code: local findX, findY, findZ = getWorldFromScreenPosition(cx, cy, 60) local rlX, rlY, rlZ = getElementPosition(localVehicle) rlZ = rlZ+4 local hit, finalX, finalY, finalZ, element = processLineOfSight(rlX, rlY, rlZ, findX, findY, findZ, true, true, true, true, false, true, true, true, localVehicle, false) if not hit then finalX, finalY, finalZ = findX, findY, findZ end if element == nil or getElementType(element) ~= "player" then createProjectile(localPlayer, 19, rlX, rlY, rlZ, 0, nil, findRotation(rlY, rlZ, findY, findZ), findRotation(rlX, rlZ, findX, findZ), findRotation(rlX, rlY, findX, findY), (findX-rlX)/60, (findY-rlY)/60, (findZ-rlZ)/60) else createProjectile(localPlayer, 20, rlX, rlY, rlZ, 1, element) end It's supposed to launch a rocket directed to the center of the screen. It works flawlessly if pointing to N or S. Otherwise, it's working, but said rockets detour after some travelled distance, which I believe to be caused by the rotation, but I really can't tell how to fix it... Maybe I'm using findRotation wrong? I've also tried setting all rotation axis' to 0, but it didn't help. Can someone help me with this? It has nothing to do with beforehand values, I've already debugged everything, and the problem is only there in the createProjectile function. Edited July 31, 2014 by Guest Link to comment
12p Posted July 31, 2014 Author Share Posted July 31, 2014 I'd be glad if someone could answer me this. Thanks beforehand. Link to comment
12p Posted August 1, 2014 Author Share Posted August 1, 2014 so, uh, yeah, again me, please, help. thanks. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now