Jump to content

how to calculate object position for different anchor point?


Recommended Posts


I want to import an object layer from Tiled map editor into a physics  engine ( p2.js ).

My problem is that p2.js uses 0.5,0.5 as anchor points, but tiled uses 0,0 (top-left).

How can i recalculate it's position so i can give it the proper coordinated for a different anchor point?


Any help is very much appreciated! 


Edit : This is easy with rectangles, but my problem is with rotated polygons.

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.

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.


  • Recently Browsing   0 members

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