Jump to content

Camera Matrix (Zango?)


qaisjp

Recommended Posts

I wonder if anyone can give me / make a script that does this? I don't exactly wan't it to show this when the main menu is shown so if you are making it there is no need to implement it. However if you already have the full code and don't mind giving it to me I will be obliged for your help ( I will edit it if you have the full code).

I believe Zango has this, correct me if i am wrong.

I tried the below but it wouldn't work (it would go all orangy and weird as if it was outside the game engine, which it is not)

So that is why I request this script instead :P

 

setCameraMatrix ( -3899.1423339844, 1324.7391357422, 7446 , -3899.1423339844, 1324.7391357422, 7460, 20, 170) 

My friend put a map up there and when I go there using /sp it works fine.

Link to comment
  • Moderators

I think that he uses a bindKey to detect if the player go back to the menu

And before he replaced his background of the menu by a transparent image manually

So when the player press the key, he starts the function which move the camera.

Link to comment
  • Moderators

Try to put a setTimer( addMoreX, 50, 0 ) for move your camera mouthly in the X axis:

local x, y, z, x2, y2, z2 = getCameraMatrix( thePlayer ) 
setCameraMatrix( x+0.5, y, z, x2, y2, z2 ) 

You can make an addMoreY too but you have to add 0.5 to the Y axis

Try to make it and if you can't make that, I will try to make it

But try first

Link to comment

Works beautifully <3

  
function moveCam(NewX,NewY,NewZ) 
    if (getElementData(getLocalPlayer(), "gamemode") == false) then 
        local x, y, z, x2, y2, z2 = getCameraMatrix( thePlayer ) 
        if not NewX then NewX = 0 end 
        if not NewY then NewY = 0 end 
        if not NewZ then NewZ = 0 end 
        setCameraMatrix( x+NewX, y+NewY, z+NewZ, x2, y2, z2 ) 
    else 
        killTimer(CamTimer) 
    end 
end 
  
addEventHandler("onClientResourceStart", getResourceRootElement(), 
    function() 
        if (getElementData(getLocalPlayer(), "gamemode") == false) then 
  
            -- Init the camera. 
            fadeCamera(true, 1.0, 0, 0, 0) 
            setCameraMatrix(-1451.81, -338.69, 14.71, -1413.49, -297.85, 25.43) 
            --setCameraMatrix ( -3899.1423339844, 1324.7391357422, 7446 , -3899.1423339844, 1324.7391357422, 7460, 20, 170) 
            CamTimer = setTimer(moveCam, 50, 0, 0.5, 0.5, 0.1) 
            setTime(0,0) 
            setWeather(9) 
        end 
    end 
) 
  

Now the basic thing work's, now do you have any idea of a good place to circulate on :3?

  • Like 1
Link to comment
  • Discord Moderators

fyi I used moveObject + getElementPosition + setCameraMatrix

you can do your own equation to calculate time of object movement by speed and distance. Create a timer with same value and design a table with route checkpoints.

as a bonus note, setting a player's camera matrix elsewhere will have the world around him unloaded, so he'll fall in underground SA when you restore his target.

sometimes doing setElementPosition once isn't sufficient either, so you need to "force" it, something like this:

repeat until setElementPosition (player, x, y, z) end 

Link to comment

Actually we have a custom event "spawnThePlayer" which contain's the following amongst other things.

repeat until spawnPlayer(bunch of arg's)

The only problem is that the timer doesn't stop even when theplayer's element data "gamemode" is NOT false.

And yes, it does change from false, to a string in fact ( "none", "freeroam", "stunt" etc...) I think the killing of the timer doesnt work >.<

Zango: So you get the element position of the player, set his camera matrix + 20 (or sumtin), then set a timer to move the camera? and then kill it after? Thank's for the tip too :)

Link to comment
  • Discord Moderators
Zango: So you get the element position of the player, set his camera matrix + 20 (or sumtin), then set a timer to move the camera? and then kill it after? Thank's for the tip too :)

As I said, I use moveObject

I move an invisible object along some coordinates and use getElementPosition on the object in setCameraMatrix

Link to comment
  • 1 month later...

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