Jump to content

Camera facing towards the vehicle (matrix)


Recommended Posts

Hello everyone! I have a question.

function cammode ()
   local x,y,z =  getElementPosition(localPlayer)
   x = x + 1
   local xx,yy,zz = getPositionInFrontOfElement(localPlayer)
   xx = xx + 1
   setCameraMatrix (x,y,z+0.5,xx,yy,zz+0.5)
end

This part of code will rotate camera well with vehicle until i change x and xx variables. I can only change the height. When i change x, xx variables camera starts moving around. I want to get x and y variables related to vehicle rotation and feel free to change them as i want. Can someone help or give me an example to make better calculations?

Link to comment
7 hours ago, Juuve said:

Hello everyone! I have a question.


function cammode ()
   local x,y,z =  getElementPosition(localPlayer)
   x = x + 1
   local xx,yy,zz = getPositionInFrontOfElement(localPlayer)
   xx = xx + 1
   setCameraMatrix (x,y,z+0.5,xx,yy,zz+0.5)
end

This part of code will rotate camera well with vehicle until i change x and xx variables. I can only change the height. When i change x, xx variables camera starts moving around. I want to get x and y variables related to vehicle rotation and feel free to change them as i want. Can someone help or give me an example to make better calculations?

 

This link might help you to accomplish your task ?. 

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