• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

SetCameraBounds + camera rotation bug

Status
Not open for further replies.
Level 5
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