HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

CBS Easy camera help

07-31-2008, 09:54 PM#1
Flame_Phoenix
Hi guys I am trying to set up the camera bounds for my inventory system, however I can't find the right values for the camera bounds. I already wasted hours trying to find them, but I feel frustrated ...
Can some one help me ?
Btw, minX and minY are both equal to "zero" ... and still I didn't find the answer !! ARghh !

Collapse JASS:
function setCamera takes nothing returns nothing
    local real minX = bootomLeftX()
    local real maxX = minX 
    local real minY = bootomLeftY()
    local real maxY = minY 
    local real centerX = (minX + maxX) / 2
    local real centerY = (minY + maxY) / 2
    local real duration=0.00
    local camerasetup windowLoc = CreateCameraSetup()
 
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_TARGET_DISTANCE, 600.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_FARZ, 1000.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_ZOFFSET, 0.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_ANGLE_OF_ATTACK, 270.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_FIELD_OF_VIEW, 70.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_ROLL, 0.00, duration)
    call CameraSetupSetField(windowLoc, CAMERA_FIELD_ROTATION, 90.00, duration)
    call CameraSetupSetDestPosition(windowLoc, centerX + 300, centerY + 125, duration)
    
    //I can't find the right value for the camera bounds, can some one help me ?
    call SetCameraBounds(minX, minY, minX, maxY+75, maxX+275, maxY+75, maxX+275, minY)
    call CameraSetupApplyForceDuration(windowLoc, true, 0.)

You guys know the drill, +rep to all those who help me =S
Attached Files
File type: w3xCBS.w3x (39.1 KB)
08-01-2008, 08:15 AM#2
Ammorth
Just set your camera bounds to the same point as your camera.

Collapse JASS:
call SetCameraBounds(centerX+300, centerY + 125, centerX + 300, centerY + 125, centerX + 300, centerY + 125, centerX + 300, centerY + 125)

of course you should precalc these values so you don't keep adding the same values.
08-01-2008, 08:26 AM#3
Flame_Phoenix
Quote:
Just set your camera bounds to the same point as your camera.
Dude you are a genius, I wonder why I didn't remember that.
+rep, you earned it well.
08-01-2008, 09:15 AM#4
Ammorth
On a side note, instead of using camera bounds to prevent scrolling (cause you have to set them back later, which can be a hassle), you can create an inivis locust unit (dummy unit of sorts) and lock the camera to that unit. This prevents scrolling and doesn't change the camera bounds. To unlock, just reset the camera (I think applying a new camera or panning does the same thing).
08-01-2008, 11:33 AM#5
Flame_Phoenix
Quote:
On a side note, instead of using camera bounds to prevent scrolling (cause you have to set them back later, which can be a hassle), you can create an inivis locust unit (dummy unit of sorts) and lock the camera to that unit. This prevents scrolling and doesn't change the camera bounds. To unlock, just reset the camera (I think applying a new camera or panning does the same thing).
Mmm they do they same thing, I see no need for a change.

EDIT EDIT EDIT

One more question, How do I reset the camera bounds ?
08-01-2008, 05:34 PM#6
Ammorth
You would have to store the original camera bounds somewhere to restore it with the SetCameraBound" function.
08-01-2008, 10:23 PM#7
Av3n
Can't you just use bj_initialMapArea or some similar var (I can't remember that one by heart) to use to calculate camera bounds back to the map area or use a rect?

-Av3n
08-01-2008, 10:35 PM#8
Flame_Phoenix
MMmm I will see what I can do.
08-02-2008, 02:11 AM#9
Ammorth
There is a GetCurrentCameraBoundsBJ() function (not sure on name) that returns the current camera bounds in rect form. You can call this before setting the camera bounds and then use it to restore them after.