sacr1ficez Posted June 2, 2019 Posted June 2, 2019 Hey, how can i zoom camera, without moving it? local x, y, z, lx, ly, lz = getCameraMatrix() smoothCameraMove(x, y, z, lx, ly, lz, x, y, z, lx, ly, lz - 0.5, 2100) Maybe a simple answer, but couldn't make it.
sacr1ficez Posted June 9, 2019 Author Posted June 9, 2019 Hey, thanks. One more question related with camera, how can i get lookX, lookY, lookZ (i need same or similar result to setCameraTarget(getLocalPlayer())). Shortly, behind player back, no matters where's looking at.
Moderators Patrick Posted June 9, 2019 Moderators Posted June 9, 2019 6 hours ago, majqq said: Hey, thanks. One more question related with camera, how can i get lookX, lookY, lookZ (i need same or similar result to setCameraTarget(getLocalPlayer())). Shortly, behind player back, no matters where's looking at. Is that what you mean? function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function getElementBackPosition(element) local x, y, z = getElementPosition(element) local _, _, rot = getElementRotation(element) local x, y = getPointFromDistanceRotation(x, y, 0.5, -rot + 180) return x, y, z end (https://wiki.multitheftauto.com/wiki/GetPointFromDistanceRotation) 1
sacr1ficez Posted June 9, 2019 Author Posted June 9, 2019 4 hours ago, stPatrick said: Is that what you mean? function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function getElementBackPosition(element) local x, y, z = getElementPosition(element) local _, _, rot = getElementRotation(element) local x, y = getPointFromDistanceRotation(x, y, 0.5, -rot + 180) return x, y, z end (https://wiki.multitheftauto.com/wiki/GetPointFromDistanceRotation) Yes, probably something like this, however, i don't know if am using it wrong, because still it doesn't give me same result like: setCameraTarget(getLocalPlayer()) does, so lookAtX, lookAtY, lookAtZ still depends from where player looks.
savour Posted June 25, 2019 Posted June 25, 2019 I think Matrix:getForward() with processLineOfSight should do the purpose
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