I'm experimenting offline with some things, and need a good way of demonstrating them.
My idea was to have a widget that focused on the average location of a players base, and zoomed in and out as the units moved, keeping every unit that the team owns on screen at any time if possible.
I'd then make videos using this and use them to make shiny things =) Anybody want to help?
Camera widget request
Moderator: Moderators
Re: Camera widget request
That's not what I need, that shows important events happening. I want to show all events happening on the screen at once for a team. If they cant be fitted on screen, zoom out and adjust position until they can.
I can figure out the place the camera should be looking at, but how do I make it pull out so that everything that team owns is on screen at once?
I can figure out the place the camera should be looking at, but how do I make it pull out so that everything that team owns is on screen at once?
Re: Camera widget request
well easiest way is probally to make the camera into a straight down view so that the viewable area is an rectangle. Then find the units most north,south,west,east and use them to get the corners of the rectangle. Then move camera into middle of rectangle and adjust height based on FOV. (as FOV can not be changed at runtime)AF wrote:I can figure out the place the camera should be looking at, but how do I make it pull out so that everything that team owns is on screen at once?
Re: Camera widget request
That last part is what I have issues with. I know how to calculate what needs to be in view, Mapwise. I don't know how to calculate the height necessary to show that rectangular region given a camera orientation or straight down
Re: Camera widget request
for straight down it might just be trig., triangle like this:
O = camera
### = ground
/\ = view cone
angle at top is cameras FOV
H = camera height
X = length of area you want to show
Code: Select all
O ^
/ \ | H
/ \ |
<--X--> v
###########
### = ground
/\ = view cone
angle at top is cameras FOV
H = camera height
X = length of area you want to show
Re: Camera widget request
>_< fail, why did I have matrices in my head
So how would I obtain the Fov?
So how would I obtain the Fov?