Jump to content

"Zoom" camera


majqq

Recommended Posts

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. :P

Link to post

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.

Link to post
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)

  • Like 1
Link to post
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.

Link to post
  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...