• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Simple camera question

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2008
Messages
127
Just a noob question here guys, how do I zoom the camera out for a player? I don't like the camera being zoomed in so much, and my map is large, so I need the camera zoomed out for all players.

Cheers
 
Level 6
Joined
May 7, 2009
Messages
228
I don't think that's right.

You want target distance, not height offset.

Also, since using the mousewheel, insert or delete keys causes the camera to revert back to the default, you'll need to either keep applying it constantly, or give the players a chat command. (The ever popular -zoom x)
 
Level 6
Joined
May 7, 2009
Messages
228
Of course it's possible

Here's how the zoom command from my map looks

JASS:
function chatZoom takes integer p, real x returns nothing
    if x<500 then        //set limits on how far the player can zoom in and out
        set x=500
    elseif x>4500 then
        set x=4500
    endif
    if GetLocalPlayer()==Player(p) then
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,x,0)
    endif
endfunction

function FuncChatEvent takes nothing returns nothing
    local integer p = GetPlayerId(GetTriggerPlayer())
    local string s = GetEventPlayerChatString()
    local real arg1
    local integer arg2
    
    // Other chat commands omitted
    
    if SubString(s,0,5) == "-zoom" then
        set arg1 = S2R(SubString(s,6,StringLength(s)))
        call chatZoom(p,arg1)   
    endif
endfunction

// Trigger initialization junk omitted
 
Status
Not open for further replies.
Top