Jump to content



Recommended Posts

I have a big problem with this code. When i enter a vehicle then the camera is attaching, and the free cam is also working. But when i rotate the vehicles x position 180 degree then the camera is at the same position. I want to attach the camera to a fix point on the vehicle. So my problem is that its not attaching the camera to that point 100 %. its a really strange bug. I could not explain it correctly, maybe you can test it, and then you will see the bug. So i want to attach it like in the bone attach resource. 


local vvx, vvy, vvz = 0,0,0

function vehicle_cam(screenX, screenY, absoluteX, absoluteY, vx,vy,vz)	
	local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer()))
	if ( vx and vy and vz ) then
		vvx, vvy, vvz = vx, vy, vz
	setCameraMatrix ( x+4.7, y-0.66, z+3.2, vvx, vvy, vvz );
addEventHandler("onClientRender", root, vehicle_cam)
addEventHandler("onClientCursorMove", getRootElement(), vehicle_cam)


Link to comment

I don't know if I understood your problem/question correctly, but I think getting your bone position (in your case BONE_HEAD) should work.


I guess you can just insert it instead of getElementPosition in your code.

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