Jump to content

Search the Community

Showing results for tags 'toLocalFrame'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. It's even kinda funny to ask such a thing, but... Phaser.Physics.P2.Body class has two useful methods to convert points to local/global metrics (docs). For instance it's said [i][b]toWorldFrame(out, localPoint)[/b][/i]/* Transform a local point to world frame. */// out:Array - The vector to store the result in.// localPoint:Array - The input local vector.Ok, fine. I've created a new body with a (0.5,0.5) anchor, moved it to 100:100 px, then i try to find out what will be the (0,0) local body point in global coordinates - obviously the point is 100:100. Let's check: // create a spritevar s = game.add.sprite(0, 0, '');// position at 100:100s.x = s.y = 100;// enable p2 to create the bodygame.physics.p2.enable(s, true);// now try to find out the local 0,0 in world metrics// holds the global point (dunno why, but it's an array rather than Point)var v = [];// relative 0:0 point in global coordinates -- should be 100:100s.body.toWorldFrame(v, [0,0]);// traceconsole.error('result', v);// wtf is this?! O_o// result [-5, -5] Same with the toLocalFrame method. So: - what do these methods calculate?! O.o - are there properly working localToGlobal(p:Point) and globalToLocal(p:Point) methods in phaser or i should implement them myself?
×
×
  • Create New...