• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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