Jump to content

camera moves in 360


Dice

Recommended Posts

trigonometry is not my thing anyone know wats uP?

It does a slight curve but not in a circle for sure.

  
function cycle() 
    a, b, c, d, e, f = getCameraMatrix() 
    local px, py, pz = getElementPosition(localPlayer) 
    if not startAngle then 
        startAngle = math.atan2 ( lx, ly ) 
    end 
    newAngle = startAngle + math.rad ( 360 ) 
    nAx = math.sin ( newAngle ) * 0.2 + a 
    nAy = math.cos ( newAngle ) * 0.2 + b 
    setCameraMatrix(nAx, nAy, c, lx, ly, lz, 0, 0) 
    sX, sY, wX, wY, wZ = getCursorPosition () 
    hit, Bx, By, Bz, elementHit = processLineOfSight ( a, b, c, wX, wY, wZ ) 
    setElementPosition ( targetMarker, Bx, By, Bz ) 
end 
  
  

Link to comment

Since you add a and b (which you got from getCameraMatrix) to nAx and nAy and then pass these values as arguments to setCameraMatrix, you are basically adding the previous position to the new one. I guess you were going to add the player coordinates instead, something like this:

    nAx = math.sin ( newAngle ) * 0.2 + px 
    nAy = math.cos ( newAngle ) * 0.2 + py 

By the way, math.rad(360) means a full turn, so the camera doesn't actually get turned. You need to put some smaller value instead of 360.

And last, you pass 0 as the last argument (FOV) to setCameraMatrix. It's not a valid value and it's 70 by default. 0 means that you infinitely zoom in.

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