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

SetCameraBounds + camera rotation bug

Status
Not open for further replies.
Level 2
Joined
Jul 24, 2007
Messages
199
So, today I came up with this crash function:

Code:
function Crash takes nothing returns nothing
    call SetCameraField(CAMERA_FIELD_ROTATION, GetRandomReal(240, 300), 0.00)
    call SetCameraBounds(-1000, -1000, -1000, 1000, 1000, 1000, 1000, -1000) // just any bounds, even GetWorldBounds()
endfunction

If not the first call, then a half-dozen calls will 100% crash your WC3 TFT 1.31. However, angles between -50 (aka 310) degrees and 230 degrees seem quite safe. [Edit: -40 to 220. Probably the danger zone is 270 ± 45.]

On a side note, SetCameraField(CAMERA_FIELD_ROTATION, ...) is in degrees, whereas GetCameraField(CAMERA_FIELD_ROTATION) returns radians. (What a hell...)

Just wanted to share this if someone else is wondering why their camera operations crash. I encountered this when I introduced SetCameraBounds in my map where camera rotation is bound to Hero facing. (Heroes travel through different locations, and in each location the minimap shows only the current location, not the entire map; redraw of minimap works terrible, but it at least shows units properly.) So, now I'm going to rotate all Heroes from the danger zone [220..320] to the closest safe angle right before updating camera bounds.

(I know that generally this is an overkill, because you EITHER lock the camera to a certain region OR lock it to a certain unit and follow its movement and rotation, but in my exact case, I needed both.)
 
Last edited:
Status
Not open for further replies.
Top