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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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