Noaml1 Posted May 23, 2014 Share Posted May 23, 2014 I kind of understand what it does, but i can't seem to utilize it. Link to comment Share on other sites More sharing options...
rich Posted May 23, 2014 Share Posted May 23, 2014 What do you think it does? And how are you trying to use it? Link to comment Share on other sites More sharing options...
Noaml1 Posted May 23, 2014 Author Share Posted May 23, 2014 I think it sets the point which the 'body' of the sprite is centered - like, this is where the sprite will revolve around or this is what will be considered in things such as onFloor() or to check if its in the bounds.I'm trying to use it on a sword to a) make it stay with my character and appear in his handb ) have a realistic fall - by this i mean, if it falls upright, i want it to slowly fall to its side...i realize that if i dont change the anchor, it floats in air and thinks its on the floor (it is much taller than it is wide) Link to comment Share on other sites More sharing options...
rich Posted May 23, 2014 Share Posted May 23, 2014 Actually all anchor does is set the position of the texture relative to the x/y coordinates. Here I've prepared this example to show: http://examples.phaser.io/_site/view_full.html?d=sprites&f=anchor.js&t=anchor Notice how the Sprite x/y position doesn't change at all, but the texture is shifting anyway? For positioning a sword on a hand of a Sprite I wouldn't use anchor, I'd put the character into a Group and then position the sword that way. Or use Sprite.pivot (which is given in pixel values) to pivot a sprite around another. Link to comment Share on other sites More sharing options...
Noaml1 Posted May 24, 2014 Author Share Posted May 24, 2014 Thanks a lot rich! helps Link to comment Share on other sites More sharing options...
mamwalter Posted June 12, 2014 Share Posted June 12, 2014 It's in PIXI.JS documentation:http://www.goodboydigital.com/pixijs/docs/classes/Sprite.html#property_pivot Link to comment Share on other sites More sharing options...
Recommended Posts