1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Camera Issue

Discussion in 'Triggers & Scripts' started by Marcelo Hossomi, Jul 16, 2009.

  1. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    Hi to you all :p

    I've got a problem in my camera... I have an elevated terrain (about 1445 height) and a cliff-border around it. The camera is locked to my unit. Theoretically, the camera height should be the same while my unit is on the flat part, but then it approaches the border the camera lowers considerably. See the picture:

    [​IMG]

    Notice that, in the second picture, you can't see the fog.

    Is there a way to keep the camera at the same height, all the time?
    Also, GetLocationZ( position of unit ) will return always the same value.

    Thanks already!
    Hossomi
     

    Attached Files:

    Last edited: Jul 16, 2009
  2. meteOrain-

    meteOrain-

    Joined:
    May 6, 2008
    Messages:
    284
    Resources:
    0
    Resources:
    0
    you can always use trigger and cameras to make that kind of height with you wanna look your game, or make for X time to wacth the game with differ camera height with trigger
     
  3. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    The problem is that I can't find a way to detect the height at which my camera is. GetCameraTargetPositionZ() is equivalent to Z-Offset, GetLocationZ( camera target ) is always the same, GetCameraEyePositionZ() does not seem to work... I'm stuck now.
     
  4. Ciebron

    Ciebron

    Joined:
    Apr 6, 2008
    Messages:
    760
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Maybe because your terrain is flat?

    Its a hell too work with cameras in places like this, have the same problem with the camera in one place on my map (no soluction yet).

    but you could try to
    GetLocationZ(Location(GetCameraTargetPositionX(),GetCameraTargetPositionY())
    (YES LEAKS) and matching with the units
     
  5. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    Does exactly as using the position of the unit, as the camera is locked to it...
     
  6. Ciebron

    Ciebron

    Joined:
    Apr 6, 2008
    Messages:
    760
    Resources:
    2
    Spells:
    2
    Resources:
    2
    When i moved around the camera only CameraEyePosistion did updates it values. so my conclution is that GetCameraEyePosistionX/Y/Z returns where acctuly the camera is.

    Test Code
    Code (vJASS):
    function CheckZ takes nothing returns nothing
        local real Ex
        local real Ey
        local real Ez
        local real Cx
        local real Cy
        local real Cz
        local real Ux = GetUnitX(PlayerHero[0])
        local real Uy = GetUnitY(PlayerHero[0])
        local real Uz
       
        call MoveLocation(Loc,Ux,Uy)
        set Uz = GetLocationZ(Loc)

        // I didnt have it like this in the screen shot, there did i set 'Ez' and 'Cz' with the natives (GetBlahblah). changed it too check LocationZ instead
        if GetLocalPlayer() == Player(0) then
            set Ex = GetCameraEyePositionX()
            set Ey = GetCameraEyePositionY()
            set Cx = GetCameraTargetPositionX()
            set Cy = GetCameraTargetPositionY()
        endif
       
        call MoveLocation(Loc,Ex,Ey)
        set Ez = GetLocationZ(Loc)
       
        call MoveLocation(Loc,Cx,Cy)
        set Cz = GetLocationZ(Loc)
       
        call ClearTextMessages()
       
        call BJDebugMsg("Ex: "+R2S(Ex))
        call BJDebugMsg("Ey: "+R2S(Ey))
        call BJDebugMsg("Ez: "+R2S(Ez))
        call BJDebugMsg("Cx: "+R2S(Cx))
        call BJDebugMsg("Cy: "+R2S(Cy))
        call BJDebugMsg("Cz: "+R2S(Cz))
        call BJDebugMsg("Ux: "+R2S(Ux))
        call BJDebugMsg("Uy: "+R2S(Uy))
        call BJDebugMsg("Uz: "+R2S(Uz))
    endfunction

    function AddCam takes nothing returns nothing
        call TimerStart(Time,0.05,true,function CheckZ)
        call LockCamera(Player(0))
    endfunction


    (Bad Picture, all values are allmost the same)

    [​IMG]
     

    Attached Files:

  7. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    I think I was doing something wrong with GetCameraEyePositionZ. I managed to keep the camera in a good position (almost always the same height). Thanks ^^