SSK2: easyCamera tracking not working with xScale/yScale set

Hello! I am having issues with SSK2 easyCamera tracking, I am using the basic ssk.camera.tracking and when I set the xScale/yScale the camera is not longer centered and not tracking properly, does anyone know how I can fix this? I have tried using :stopCamera() method on the object and then re-initialised it, but it still does not seem to take in to account the xScale/yScale, any suggestions/recommendations would be greatly appreciated.

Apologies for the delay.  I am not very active in the Forums any more.

Unfortunately, I did not design the SSK2 cameras to account for scaled groups.  This is actually a bit of an advanced topic (at least not a beginner topic) and more importantly how you code to handle it is dependent upon how you intend to use the camera and set up the view.

So… long story short, I did not bother implementing it.  That said, once you grok the basics of camera code you can you tweak my camera code or write your own to suit your needs.

The biggest things to keep in mind are:

  1. Scaled groups need to have translation rates inversely scaled to maintain uniform movement for rates.  i.e. group scaled x2 needs to be translated at 0.5 normal rate.

  2. If you are going to use a scaling, your world group should be centered starting out.  Scaling groups scale about the group origin.  This origin is usually in the upper-left of the screen and you need to account for this.  Pre-centering is one way to do that.

Without reference to the scale, the camera moves the wrong number of pixels.

If you adjust the world function to account for scale, the camera will scale just fine.

local currentScale = 1 -- current zoom level/scale world.enterFrame = function( event )      local dx = 0      local dy = 0      if(not lockX) then dx = trackObj.x - lx end      if(not lockY) then dy = trackObj.y - ly end      if(dx ~= 0 or dy ~= 0) then           dx = dx \* currentScale ; dy = dy \* currentScale -- this should do it!           world:translate(-dx,-dy)           lx = trackObj.x           ly = trackObj.y      end return false end listen( "enterFrame", world )

Apologies for the delay.  I am not very active in the Forums any more.

Unfortunately, I did not design the SSK2 cameras to account for scaled groups.  This is actually a bit of an advanced topic (at least not a beginner topic) and more importantly how you code to handle it is dependent upon how you intend to use the camera and set up the view.

So… long story short, I did not bother implementing it.  That said, once you grok the basics of camera code you can you tweak my camera code or write your own to suit your needs.

The biggest things to keep in mind are:

  1. Scaled groups need to have translation rates inversely scaled to maintain uniform movement for rates.  i.e. group scaled x2 needs to be translated at 0.5 normal rate.

  2. If you are going to use a scaling, your world group should be centered starting out.  Scaling groups scale about the group origin.  This origin is usually in the upper-left of the screen and you need to account for this.  Pre-centering is one way to do that.

Without reference to the scale, the camera moves the wrong number of pixels.

If you adjust the world function to account for scale, the camera will scale just fine.

local currentScale = 1 -- current zoom level/scale world.enterFrame = function( event )      local dx = 0      local dy = 0      if(not lockX) then dx = trackObj.x - lx end      if(not lockY) then dy = trackObj.y - ly end      if(dx ~= 0 or dy ~= 0) then           dx = dx \* currentScale ; dy = dy \* currentScale -- this should do it!           world:translate(-dx,-dy)           lx = trackObj.x           ly = trackObj.y      end return false end listen( "enterFrame", world )