jkub Posted November 25, 2008 Share Posted November 25, 2008 im trying to use getCameraPosition in a script and it is not working it says its a nil value? i simply want it to get the pos of the player and set the cam to fixed then set the position to the pos it got from the player function newCam ( source ) setCameraMode ( source, "fixed" ) local x, y, z = getCameraPosition ( source ) setCameraPosition ( source, x, y, z ) end Link to comment
50p Posted November 26, 2008 Share Posted November 26, 2008 If you're using the latest server (Nightly build) then it's setCameraMatrix and getCameraMatrix. If you want to get player's position you need to use getElementPosition (I can't see it in your code). Link to comment
jkub Posted November 26, 2008 Author Share Posted November 26, 2008 i just tryed the matrix thing instead and it does the same exact thing wich gives me that attempt to call global getCameraMatrix (a nil value) ? Link to comment
Ace_Gambit Posted November 26, 2008 Share Posted November 26, 2008 Make sure you get the latest build (current revision is 77). Also setCameraMode does no longer exist. You must use setCameraTarget to go back to chasing mode afaik. Link to comment
arc_ Posted November 27, 2008 Share Posted November 27, 2008 getCameraPosition doesn't exist serverside - DP2 doesn't sync players' cameras to the server. If you need getCameraPosition, use a clientside script. And just out of curiosity, what exactly is the point of getting the camera position and then immediately setting the same position again? Link to comment
Gamesnert Posted November 27, 2008 Share Posted November 27, 2008 And just out of curiosity, what exactly is the point of getting the camera position and then immediately setting the same position again? I guess so that the camera doesn't move with the player, but stays at the same position. That's what I can understand out of the code and his explanation. Did indeed look a little weird on first watch though... ^^ Link to comment
50p Posted November 27, 2008 Share Posted November 27, 2008 And just out of curiosity, what exactly is the point of getting the camera position and then immediately setting the same position again? I guess so that the camera doesn't move with the player, but stays at the same position. That's what I can understand out of the code and his explanation. Did indeed look a little weird on first watch though... ^^ From what he described I understand that he wants to set camera inside of player's ass; like an FPS but camera set a bit lower then head. Link to comment
Magus1724 Posted February 2, 2009 Share Posted February 2, 2009 I was wondering if it would be hard to place the camera to a player so you can walk around like in an FPS game, and wonder how well it would work, or if it would be awkward So has anyone ever tried this before? I'm posting here instead of making a new topic Link to comment
50p Posted February 2, 2009 Share Posted February 2, 2009 Camera would be flickering becausr the distance you travel between frames is so long that camera wouldn't be smooth. Someone would say "Use onClientPreRender", but what's the difference? It is still executed every frame and as I said the distance travelled between frames is too long for camera to be smooth. Both onClientPreRender and onClientRender would have to be used but I doubt it would be smooth enough. In addition it would drop down fps on slower PCs. Link to comment
Magus1724 Posted February 3, 2009 Share Posted February 3, 2009 So it's possible, but basically unpractical? I have enough trouble running MTA with my machine as it is What about a flying spectator camera? like in the race editor? would that have the same issue since you are moving so fast? But I'm guessing that was done much differently than if it would be scripted? Link to comment
50p Posted February 4, 2009 Share Posted February 4, 2009 It's done the same way but you don't see the camera "jumping". The problem with that camera is that onClientRender isn't triggered every frame. Maybe it is but some frames are skipped if you have too much code executed at one frame and the code is carried over to the next frame. That's what I noticed. So it's possible to make that "flying camera" and you can find it in a gamemode "fallout" (file "freecamclient.lua") Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now