Jump to content

Spawning objects with mouse - Canvas -> Box2d Coordinates


Recommended Posts

Edit: Solved. I should have looked harder.

   $(window).click(function() {

      var mouse = renderer.plugins.interaction.mouse.originalEvent;
      var x = (mouse.pageX - stage.position.x) / stage.scale.x / drawScale;
      var y = (mouse.pageY - stage.position.y) / stage.scale.x / -drawScale;
      var ball = new Ball(x, y);

Edited by icEEE
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...