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

how to lock camera to specific location

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,657
-_-
That is what I said.
But didnt knew for sure if you would use JASS or GUI so I just said the 1x1 or 0x0 region.
That one however, sets the bounds to the center of the map.

This one sets the boundary to x,y or to the cameras current (use inside GetLocalPlayer())
JASS:
function LockCameraOnCoordinate takes real x, real y returns nothing
    call SetCameraBounds(x, y, x, y, x, y, x, y)
endfunction

function LockCamera takes nothing returns nothing
    call LockCameraOnCoordinate(GetCameraTargetPositionX(), GetCameraTargetPositionY())
endfunction
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
How about locking the angle of attack?
I used this with a periodic timer but I'm not sure if it's the best way
JASS:
private function PeriodicCameraPosition takes nothing returns nothing
    call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 270, 0)
    call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 3000, 0)
endfunction

with a call TimerStart(periodic, 0.03125, true, function PeriodicCameraPosition)
 
Status
Not open for further replies.
Top