• 🏆 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!

Is it possible to disable arrow-key camera panning?

Status
Not open for further replies.
Well, that's about it. Is it possible to disable the built in camera panning that warcraft has?

I've done a system wherethe arrow keys are used for other things, but the camera is not locked to anything and should be pannable through moving the mouse. Therefore i don't want the camera to fly away everytime an arrow key is pressed. All help is appreciated.

Thanks.
 
as far as I know, you cannot disable it on free cameras but you can make it look like that,

but you need to know how fast the camera moves when you press a button, then do a trigger which if you press that button, you pan the camera to a location that will negate the effect (not the current position because that would bug if you press a key plus scroll using a mouse)

example: if the camera's speed is about 1000 units per second, then if you press a key, move it to a location 1000 units on the other direction...

Note: this is just hypothetical, I haven't tested it myself so I dont know if it would work fine...
 
  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to Control <gen> the event (Player - (Player((Integer A))) Presses the Left Arrow key)
          • -------- keep adding events for each arrow --------
      • -------- helps performance --------
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
  • Control
    • Events
    • Conditions
    • Actions
      • -------- Removes leaks --------
      • Set temp_point = (Target of current camera view)
      • -------- Create a dummy unit, then save it in a variable, which you can later use if you release an arrow key --------
      • Unit - Create 1 Dummy Unitfor (Triggering player) at temp_point facing Default building facing degrees
      • Set camera_unit[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Camera - Lock camera target for (Triggering player) to (Last created unit), offset by (0.00, 0.00) using Default rotation
      • -------- Removes leaks --------
      • Custom script: call RemoveLocation(udg_temp_point)
 
Won't those suloutions make the camera fixed to one position?
The concept of my system is to be able to use the arrow keys to manipulate the camera zoom and rotation, while you use the mouse to pan it around.
To freeze camera movement while pressing the keys is a pretty good suloution though, it will certainly work, although it might turn out a bit stiff.
If there is a way to negate the movement of the arrow keys i'd be very glad, though otherwise i guess i'll use GhostThrusters idea. ;)
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Theres a way to stop camera panning without locking it, i made it in a map before ill upload it in a second. I think that should work

  • Test
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (Number of players), do (Actions)
        • Loop - Actions
          • Set Players = (Player((Integer A)))
          • Trigger - Run Test1 <gen> (ignoring conditions)
          • Trigger - Add to Test1 <gen> the event (Player - Players Presses the Left Arrow key)
          • Trigger - Add to Test1 <gen> the event (Player - Players Presses the Right Arrow key)
          • Trigger - Add to Test1 <gen> the event (Player - Players Presses the Down Arrow key)
          • Trigger - Add to Test1 <gen> the event (Player - Players Presses the Up Arrow key)
  • Test1
    • Events
    • Conditions
    • Actions
      • Set Point = (Target of current camera view)
      • Camera - Pan camera for Players to Point over 0.00 seconds
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
I'll not fix it. I'm making new one.

EDIT: Well,there's problem. Warcraft registers arrow key press with a delay,which means it doesn't stop the camera immediately.
By some examination,it seems that IA's solution would work,but to make it MPI,you need to make it this way:
  • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
  • Set Point = (Target of current camera view)
  • Custom script: endif
  • Camera - Pan camera for (Triggering Player) to Point over 0.00 seconds
The problem is that is stops the camera after a delay of say half a second thus it moves camera a bit and that's unfixable,as far as i know.
If you want camera to pan back where it was,you can use script i wrote now,however it still has delay as first solution.
JASS:
function Left takes nothing returns boolean
    call ForceAddPlayer(udg_CamForce,GetTriggerPlayer())
    set udg_X[GetPlayerId(GetTriggerPlayer())] = 230.0
    set udg_Y[GetPlayerId(GetTriggerPlayer())] = 0
    return false 
endfunction

function Right takes nothing returns boolean
    call ForceAddPlayer(udg_CamForce,GetTriggerPlayer())
    set udg_X[GetPlayerId(GetTriggerPlayer())] = -230.0
    set udg_Y[GetPlayerId(GetTriggerPlayer())] = 0
    return false 
endfunction

function Up takes nothing returns boolean
    call ForceAddPlayer(udg_CamForce,GetTriggerPlayer())
    set udg_X[GetPlayerId(GetTriggerPlayer())] = 0.00
    set udg_Y[GetPlayerId(GetTriggerPlayer())] = -230.0
    return false 
endfunction

function Down takes nothing returns boolean
    call ForceAddPlayer(udg_CamForce,GetTriggerPlayer())
    set udg_X[GetPlayerId(GetTriggerPlayer())] = 0.00
    set udg_Y[GetPlayerId(GetTriggerPlayer())] = 230.0
    return false 
endfunction

function Release takes nothing returns boolean
    call ForceRemovePlayer(udg_CamForce,GetTriggerPlayer())
    return false 
endfunction

function CamLoop takes nothing returns boolean
    local integer i = 0
    loop
        if IsPlayerInForce(Player(i),udg_CamForce) and GetLocalPlayer() == Player(i) then
            call PanCameraTo(udg_X[i],udg_Y[i])
        endif
        set i = i + 1
        exitwhen i > 11
    endloop
    return false 
endfunction

//===========================================================================
function InitTrig_Camera_Pan takes nothing returns nothing
    local integer i = 0
    local trigger t
    loop
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_LEFT_DOWN)
        call TriggerAddCondition(t,Condition(function Left))
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_RIGHT_DOWN)
        call TriggerAddCondition(t,Condition(function Right))
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_UP_DOWN)
        call TriggerAddCondition(t,Condition(function Up))
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_DOWN_DOWN)
        call TriggerAddCondition(t,Condition(function Down))
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_LEFT_UP)
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_RIGHT_UP)
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_UP_UP)
        call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_DOWN_UP)
        call TriggerAddCondition(t,Condition(function Release))
        set i = i + 1
        exitwhen i > 11
    endloop
    set t = CreateTrigger()
    call TriggerRegisterTimerEvent(t,0.03,true)
    call TriggerAddCondition(t,Condition(function CamLoop))
    set t = null
endfunction
Just copy this text in a trigger and make variables: X (real array),Y (real array),CamForce (PlayerGroup) in variable menager if you want to use it.
 
Last edited:
Status
Not open for further replies.
Top