Jump to content

setCameraMatrix and Move Vehicle?


undefined

Recommended Posts

How to setCameraMatrix on vehicle?

Im tryed this but its not worked.

local vehicle = createVehicle(470, 320, 1980, 25, 0, 0, 90) 
setCameraMatrix( source, vehicle ) 

And how to move vehicle?

like this

object = createObject(3567, 0, 0, 30, 0, 0, 0) 
moveObject(object , 6000, 0, 0, 14, 0, 0, 0) 

Link to comment

You cannot target a vehicle like that. You must create your own 3D camera in order to be able to do that. However, if you want a fixed position, then use the vehicle position as the third, fourth and fifth arguments.

addEventHandler( "onClientPreRender", root, 
     function( ) 
          local x, y, z = getElementPosition( vehicle ) 
          setCameraMatrix( x + 8, y + 8, z + 5, x, y, z ) 
     end 
) 

If you really want to move a vehicle like that then create an invisible object and attach the vehicle to the object. Then move the object. If you want to make it look realistic, then use control states in combination with a ped inside the vehicle as a controller.

P.S.

My GitHub page has a custom 3D camera system, feel free to use that as well.

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