Jump to content

smoothMoveCamera


Recommended Posts

Hi!
I want to use smoothMoveCamera, but i don't really understand how.
 

function moveCamera()
local deathX, deathY, deathZ = getElementPosition(source)
  setCameraMatrix (deathX, deathY, deathZ, deathX, deathY, deathZ+50)
  end
addEventHandler ("onPlayerWasted", getRootElement(), moveCamera)

The thing i want to do, it to move from deathZ to deathZ+50 in for example 30 seconds, and i think i can use smoothMoveCamera for this, but i dont know how.

Could you please help me?

Link to comment

You could use interpolateBetween for it.

function moveCamera()
	deathX, deathY, deathZ = getElementPosition(source)
	setCameraMatrix (deathX, deathY, deathZ, deathX, deathY, deathZ+50)
	startingTime = getTickCount()
	timeToFinish = 10000
end
addEventHandler ("onPlayerWasted", getRootElement(), moveCamera)

addEventHandler("onClientRender", getRootElement(), function()
	local progressC = (getTickCount() - startingTime)/timeToFinish
	local cX, cY, cZ = interpolateBetween(
		0, 0, deathZ
		0, 0, deathZ+50
		progressC, "InOutQuad")
	setCameraMatrix(deathX, deathY, cZ)
end)

I think this one should work.

Edited by NeXuS™
Link to comment

Buddy, you gotta start checking the scripts, because these errors are easy to fix.

local cX, cY, cZ = interpolateBetween(
	0, 0, 0, deathZ,
	0, 0, deathZ+50,
	progressC, "InOutQuad")
setCameraMatrix(deathX, deathY, cZ)

 

Edited by NeXuS™
  • Like 1
Link to comment

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