Jump to content

Camera


developa

Recommended Posts

function followPed()
	local position = {getElementPosition(localPlayer)}
	local pedPosition = {getElementPosition(ped)}
	setCameraMatrix(position[1], position[2], position[3], pedPosition[1], pedPosition[2], pedPosition[3])
end
addEventHandler("onClientPreRender", root, followPed)

 

something like this?

Link to comment

Yep, just like that. I mean, if you want the camera to be in an exact pos, you can just change

local position = {getElementPosition(localPlayer)}

to a fix one, and then it would be a static cam which would follow a ped. If you need further help, feel free to ask.

  • Like 1
Link to comment
ped = createPed(135, 361.39, 171.45, 1025.79, 180)
setElementDimension(ped, 5)
setElementInterior(ped, 3)

function followPed()
	local position = {getElementPosition(localPlayer)}
	local pedPosition = {getElementPosition(ped)}
	setCameraMatrix(position[1], position[2], position[3], pedPosition[1], pedPosition[2], pedPosition[3])
end
addEventHandler("onClientPreRender", followPed)

 

Link to comment

What does this output?
 

ped = createPed(135, 361.39, 171.45, 1025.79, 180)
setElementDimension(ped, 5)
setElementInterior(ped, 3)

function followPed()
	outputChatBox(tostring(isElement(ped))
	--local position = {getElementPosition(localPlayer)}
	--local pedPosition = {getElementPosition(ped)}
	--setCameraMatrix(position[1], position[2], position[3], pedPosition[1], pedPosition[2], pedPosition[3])
end
addEventHandler("onClientPreRender", followPed)

 

Link to comment
ped = createPed(135, 361.39, 171.45, 1025.79, 180)
setElementDimension(ped, 5)
setElementInterior(ped, 3)

function followPed()
	outputChatBox(tostring(isElement(ped))
	local position = {getElementPosition(localPlayer)}
	local pedPosition = {getElementPosition(ped)}
	outputChatBox("X: " .. position[1] .. " Y: " .. position[2] .. " Z: " .. position[3])
	outputChatBox("PedX: " .. pedPosition[1] .. " PedY: " .. pedPosition[2] .. " PedZ: " .. pedPosition[3])
	--setCameraMatrix(position[1], position[2], position[3], pedPosition[1], pedPosition[2], pedPosition[3])
end
addEventHandler("onClientPreRender", followPed)

Does this output everything?

Link to comment

It works just fine for me mate.

ped = createPed(135, 361.39, 171.45, 1025.79, 180)
setElementDimension(ped, 5)
setElementInterior(ped, 3)

function followPed()
	outputChatBox(tostring(isElement(ped)))
	local position = {getElementPosition(localPlayer)}
	local pedPosition = {getElementPosition(ped)}
	outputChatBox("X: " .. position[1] .. " Y: " .. position[2] .. " Z: " .. position[3])
	outputChatBox("PedX: " .. pedPosition[1] .. " PedY: " .. pedPosition[2] .. " PedZ: " .. pedPosition[3])
	setCameraMatrix(position[1], position[2], position[3], pedPosition[1], pedPosition[2], pedPosition[3])
end
addEventHandler("onClientPreRender", root, followPed)

 

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