Current camera view

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,504
You know this white region on the minimap that shows what part of the map
you're currently looking at?

How do you find that region's coordinates?
(The four corners or one corner or the center and a size, whatever)


Why would I need this?
Glad you asked.
Well, it's simple to lock the camera to a unit.
I want this the other way around: Lock a unit inside the current view...
As in, moving it "back" if it gets outside.
The problem is to determine when exactly it's outside.
 
Try setting a region, and maybe moving it to the camera's current postition? (Just make the region the size of the screen). I'm pretty sure you can set it to the camera positition, but I don't have the editor in front of me.
 
You can set a point to the "Target of current camera view", so i guess that would be the way of doing it. But what if you zoom in?
 
I once tried to make a function that returned the rect of the curernt wiev, failed becuse my lack of math skill ^^

There is some usefull functions that you (wich hopefully is better at math than me ^^) can use.

local camerasetup c = GetCurrentCameraSetup()

is the camera configuration for the local player.

local real x = CameraSetupGetDestPositionX(c)
local real y = CameraSetupGetDestPositionY(c)


is the x,y cordinates for the cameraconfiguration

local real W = CameraSetupGetField(c,CAMERA_FIELD_FIELD_OF_VIEW)

the field of wiev width, NOT THE GROUND LENGHT, that also depends on the distance

local real D = CameraSetupGetField(c,CAMERA_FIELD_TARGET_DISTANCE)

the distance from the 'camera eay' to the target point (hopefully)

local real I = CameraSetupGetField(c,CAMERA_FIELD_ANGLE_OF_ATTACK)

the angle of attack, 270 is from straight above.


Since I cant calulate the lenght of a side in a triangle when one angle isnt 90* i failed here :(
 
Lol, im math dumb, so I remembered this. If u have WEU and create a new map, it puts the starting point unit thing right in the middle of the map.
 
AceHart said:
You know this white region on the minimap that shows what part of the map
you're currently looking at?

How do you find that region's coordinates?
(The four corners or one corner or the center and a size, whatever)


Why would I need this?
Glad you asked.
Well, it's simple to lock the camera to a unit.
I want this the other way around: Lock a unit inside the current view...
As in, moving it "back" if it gets outside.
The problem is to determine when exactly it's outside.

lower left of the world editor tell you coordinates
 
> It can't be done with "Unit - A unit leaves (Current camera bounds)"?

The "current camera bounds" are, more or less, the entire map.
It's what you see with "View / Camera bounds" (the blue border)...

> lower left of the world editor tell you coordinates

Hm...
And, if the view is moving?
What about different resolutions?

> Since I cant calulate the lenght of a side ...

I can. But that's supposedly total overkill.
Even more so if it needs to be done at least once every second...

> Try setting a region ...

What size? Works in all resolutions?
What if the view moves?


Events based on regions don't work with moving regions.

I need something dynamic that doesn't involve higher math.
The problem isn't the math, but the potential lag if "impressive" calculations need to be performed "way too often".


Hm.
Any more ideas?
It doesn't have to be tested or verified or just assumed-to-work.
Anything is welcome.
Afraid it might be total garbage? Let me be the judge ;)


Yours,
AceHart
 
Tom_Green said:
Lol, im math dumb, so I remembered this. If u have WEU and create a new map, it puts the starting point unit thing right in the middle of the map.

Actually it puts it offset by 500,0. Take your cursor and turn large grids on, then go to an intersection point where they cross and in the bottom right it shows coordinates (XXXX,YYYY,ZZZ). Find 0,0,Z (Z is the terrain height so it isnt important) then verify the map size so that the coordinates of X is the same on one side as the other (Except for being negative,positive) and same for the Y. Then that will be the middle.

For you Acehart, try making a bunch of small doodads and putting them at different corners. Then have 1 different from the rest in the center. Write down which ones are closest to the corners on a paper then go back to world editor and make a region from one to the other. Then use the region - move region (or center it) and move it like every .5 seconds. Not sure of any leaks not knowing JASS, but im sure you can clean it up. Then when the unit leaves the region either move the unit backwards instantly, or move the camera bounds. You would also need to either keep the camera the same (with an every .2 second trigger to reset it) or allow camera modes, unless you can detect what state the camera is in.
 
Time for some questions from me then ^^

Can the player change the angle and/or the rotation of the camera?

If he cannot it is probebly quit easy to find some (inaccurate)constants that you can use insteed of heavy math.

Alos moving a region isnt a bad idea (if YES on my first question) you mustent use a trigger to detect when the unit leaves. If the rect is updated each 0.5 sec it is fair that the check for 'unit has left' apperes right after, ie if the unit isnt in the region he must be returned back.
 
AceHart said:
> It can't be done with "Unit - A unit leaves (Current camera bounds)"?

The "current camera bounds" are, more or less, the entire map.
It's what you see with "View / Camera bounds" (the blue border)...
Sorry, I didn't know that.
Anyhow, why are they called "CURRENT Camera Bounds"?
Are they dynamic??
 
I've finally settled on some other idea:
I have an invisible, unselectable unit onto which the camera is locked.
Has the advantage that the unit is right in the very center of the view.
My "test" for outside is, then, a simple "distance between points".

Obviously, that isn't pixel perfect, but that isn't required anyway.

Still, if anyone comes up with some other idea, don't hesitate.


Yours,
AceHart
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.
  • A Andyoyo:
    Thank you for the hard work over the years. It did not go unnoticed.

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top