0 Favourites

Auto Zoom?

This forum is currently in read-only mode.
  • Subscribe to Construct videos now

    Pretty likes this, expect what the Camera to zoom in as the player gets close to the enemy. I've seen that other one, but I'm using MagiCam/Advance Camera. So, if anyone has any idea, I'm open for it.

  • That's one of the things that I've been working to add to the MagiCam plugin. I'll look into finishing it up soon.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Set the zoom based on the distance between the players.

  • Hmm. I'll Look in to that.

    Doesn't seem to work. X Zoom works, but Y Zoom... seems to mess up.

    I set X and Y Zoom at 50, and the camera spazzes out.

    Also, it Zooms in as they are farther apart. I want it to zoom out the more apart they are from each other. I tried a negative number, but it flip the screen.

  • Even if you don't want to use the auto-zoom-engine, why not take a look? And then just copy the parts that do what you need

  • Just updated the MagiCam plugin with a zoom to fit feature. Check it out here.

    In case you're curious, the way I handle it in the plugin is that I first find which objects are the farthest left, right, up, and down, with the respective X/Y coordinates specified as:

    farLeft, farRight, farTop, forBottom[/code:3fhfk5h5]
    The formula for figuring out the zoom value is then:
    
    [code:3fhfk5h5]// Find the distance between the extreme horizontal and vertical positions
    SpaceX = abs(farLeft - farRight)
    SpaceY = abs(farTop - farBottom)
    
    // Calculate what the zoom needs to be on each axis to encompass all objects
    TempZoomX = WinWidth / (SpaceX + ((HorizontalMargin * 2) / (WinWidth / SpaceX))
    TempZoomY = WinHeight / (SpaceY + ((VerticalMargin * 2) / (WinHeight / SpaceY))
    
    // Find the smallest zoom value
    FinalZoom = min(TempZoomX, TempZoomY)
    
    // Set the zoom to the smallest zoom value
    ZoomX = FinalZoom
    ZoomY = FinalZoom[/code:3fhfk5h5]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)