JeViCo Posted September 11, 2018 Share Posted September 11, 2018 Hello! I'm trying to make the player rotate +-30° in both directions with onClientCursorMove event something like this -- aX is an absolute position of cursor in this event local w, h = guiGetScreenSize() aX = aX - w / 2 local h_rot = rz+aX/2 -- aX/2 - make rotation smoother if h_rot >= 360 then h_rot = h_rot - 360 elseif h_rot < 0 then h_rot = 360 + h_rot end --local crot_l = sh.camrot - 30 --local crot_r = sh.camrot + 30 --print("h_rot: "..math.floor(h_rot)..", crot: "..math.floor(crot)) --if h_rot >= crot_l and h_rot <= crot_r then setElementRotation(localPlayer,0,0,h_rot) --end Link to comment
Jayceon Posted September 12, 2018 Share Posted September 12, 2018 Like in Vice City camera/ped rotation? When you move your cursor the ped rotate by the camera. Link to comment
JeViCo Posted September 12, 2018 Author Share Posted September 12, 2018 (edited) 26 minutes ago, Jayceon said: Like in Vice City camera/ped rotation? When you move your cursor the ped rotate by the camera. not really. I made a camera angle looking towards the ped. This camera is not moving at all - just staying still (static in general). I want to make this: when i press and hold right mouse button ped will rotate. If i move a mouse right, ped'll rotate clockwise, left - counterclockwise. Also i want to make a limit - player can be rotated until it reach: original_rotation + 30 degrees OR original_rotation - 30 degrees Sorry if you can't understand something cuz i'm not english-speaking really @Jayceon Edited September 12, 2018 by JeViCo 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