Jump to content

Over the shoulder camera view style.


TomPlays

Recommended Posts

  • Moderators
Posted

Check out this example on wiki:

https://wiki.multitheftauto.com/wiki/GetCamera

I haven't tried it myself, but it might do what you want(if you edit it ofcourse).

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

That just gets the camera, you'll want to use setCameraMatrix for something like that. Do note that it'll probably take quite a bit of math to get it the way you want.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

  • Moderators
Posted

Well this will do it, without rendering with setCameraMatrix. But aiming with the gun is kinda impossible.

local cam = getCamera() 
setElementPosition( cam, 0,0,0 ) 
attachElements( cam, localPlayer, 0.2,-2,0.8, 0,0,0 ) 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

Well, here's my code. I have no Idea what I'm doing btw, so if someone could help me :DD

function setCameraOnPlayerJoin() 
local cam = getCamera() 
setElementPosition( cam, 0,0,0 ) 
attachElements( cam, getLocalPlayer, 0.2,-15,0.8, 0,0,0 ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 

but i get error attempt to call global 'getCamera' (a nil value) on line 2

Posted

You can not use client-side only functions in a server-side script.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

  • MTA Team
Posted

setCameraMatrix, getCameraMatrix, onClientMouseMove, getElementPosition, getPedBonePosition

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