Jump to content

Draw sprite in perspective


deohnas
 Share

Recommended Posts

that's a tilted camera so the objects that are farther away appear smaller. 

You can accomplish this by skewing/warping the image - not supported in phaser by default, but you can modify the internal updateTransform method for display objects so the x and y axis is skewed appropriately. Or do what samme suggested and perform the transforms on a separate canvas with a bitmap data object. See this thread: 

You could also go with a more practical camera view such as isometric. In which case, you could simply rotate the image -45 degrees and reduce the height (y axis) by 50%. You end up with something like this:

58c9721bda618_ScreenShot2017-03-15at12_32_30PM.png.5800a31bab5d2e0f063fb7344433509a.png

Link to comment
Share on other sites

 

@feudalwarsI think his requirement for a perspective projection requires more effort, skewing and scaling are affine transformations and can be done with the answer provided by @samme, but projection is not I believe .. Correct me if im wrong though:p..

https://en.wikipedia.org/wiki/Transformation_matrix#Perspective_projection

But switching to isometric view could be an alternative solution.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...