HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Camera distance, able to force it?

01-19-2008, 08:11 PM#1
Jitse
I've got some problems with the camera distance, you can change it using a function, but that will reset whenever the user starts zooming in or so. After the user zoomed in he won't be able to zoom out as much as how I initialized it.

Collapse JASS:
call SetCameraFieldForPlayer( Player(0), CAMERA_FIELD_TARGET_DISTANCE, 2500.00, 0 )

And this isn't really the perfect solution, even if it would stay that way. I actually just want to change the maximum zoomout, but I can't find it anywhere. Is this possible?

Edit: I could possibly do it with a trigger resetting the camera every time again the user zooms in or out or so, but that's not really polite. :p

Thanks in advance
01-19-2008, 08:30 PM#2
Troll-Brain
i don't think it's possible but it can be wrong.
You can also let the player to set his camera distance when he press the escape
Collapse JASS:
(TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_END_CINEMATIC))
for example
01-19-2008, 08:50 PM#3
EnderA
Quote:
Originally Posted by Troll-Brain
i don't think it's possible but it can be wrong.
You can also let the player to set his camera distance when he press the escape
Collapse JASS:
(TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_END_CINEMATIC))
for example

I hate it when a map uses ESC for bringing up a menu. It can completely disrupt the flow of the game.

I would just make a chat command "-cam", "-camera", or "-zoom" for it. Either allow them to say the distance with the command, or if you must, bring up a menu then.
01-19-2008, 08:55 PM#4
Jitse
Yes, I saw other maps using that solution. Still it's extremely weird Blizzard didn't make it possible for us to change the camera zoom bounds, isn't it? Is there a particular reason for this? Like video performance or so?
01-19-2008, 09:28 PM#5
xombie
Quote:
Originally Posted by Jitse
Is there a particular reason for this? Like video performance or so?

Blizzard doesn't allow alot of things.
01-20-2008, 02:46 AM#6
Joker
Quote:
Originally Posted by EnderA
I hate it when a map uses ESC for bringing up a menu. It can completely disrupt the flow of the game.
How So?
01-20-2008, 02:50 AM#7
Malf
When you open a spellbook, learning skills, cancelling a targeted spell, you press ESC. You would then trigger the menu as well.
01-20-2008, 12:56 PM#8
Jitse
If there existed an event, that gets triggered whenever the user changes the camera distance or position. You could make an algorithm that calculates the camera positions with the distance offset you initialized at the beginning. But I suppose such an event doesn't exist. =/ I searched the functions and constants list, but couldn't find anything like that.
01-20-2008, 05:16 PM#9
TaintedReality
I think pretty much the only way to lock the camera smoothly is to loop at a rate faster than war3's frame rate, and set the camera position each time. Or just use text commands or whatever.
01-20-2008, 08:30 PM#10
EnderA
Quote:
Originally Posted by Joker
How So?

Quote:
Originally Posted by malf
When you open a spellbook, learning skills, cancelling a targeted spell, you press ESC. You would then trigger the menu as well.

Precisely. If it were a text message or something that simply provides information, then fine, I can deal with that. But if it's bringing up one of those block menus... I have to take the time to exit the menu before I can continue playing the game - every time I press escape. As malf said, this is any time I cancel something in-game. (The only exception to this is pressing escape while typing a text message.)

Besides, how often do you really need to change camera distance?
01-21-2008, 05:26 PM#11
Jitse
I tried this, and it runs quite smoothly, especially because of the change distance to target over time I did, instead of instantly. Even if you notice a little zooming in when changing position, it feels as if its meant to be like that, because it goes slowly. You can make it smoother by narrowing the time window.

I don't know how many map designers would like to have such a loop in their map though. I monitored it, and it doesn't use up any more CPU time than it does without the loop, in my case.

Collapse JASS:
library CameraLock initializer InitTrig

private function Actions takes nothing returns nothing
    call SetCameraFieldForPlayer( Player(0), CAMERA_FIELD_TARGET_DISTANCE, 2500.00, 1 )
endfunction

//===========================================================================
private function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterTimerEventPeriodic(trig, 0.10)
    call TriggerAddAction(trig, function Actions)
endfunction

endlibrary
01-21-2008, 05:39 PM#12
Troll-Brain
set a variable or change the camera is quite the same (for the processor)
01-21-2008, 05:53 PM#13
Jitse
Yes, I also thought about that. But then forgot to mention it in my post, hehehe. Though there is a difference here, two functions still have to be called, the Actions function and the function to change the distance to target.

I'm also wondering if this would be feelable by a low-performance pc.
01-21-2008, 06:05 PM#14
TaintedReality
I doubt it, 0.10 is a pretty long period for such a light function.
01-22-2008, 12:56 AM#15
xombie
If you have all of the cameras running on a single timer its not too unfriendly to just use the 0.025 frequency. Fourty times per second is easy to work with, and it is much faster than the human eye can see.