New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pivot affects object position #190
Comments
I managed to do this by setting the pivot and position of the graphics to its center, and then I drew the graphics around this point. |
I answered your question on stackoverflow with a code example here: http://stackoverflow.com/questions/17505169/pixi-js-pivot-affects-object-position/18007977#18007977 |
@GoodBoyDigital Is pivot effecting position, and if so is that a quick fix? |
I've actually been confused about |
Well, |
It sounds like this can be used as the same point. I've actually never seen these separated before in rendering (css transform-origin, flash's registration) was there a use case this accounted for? If so, can everything default to one thing, and then use another if set? Maybe default to anchor everywhere including rotation, unless pivot is a point, use that for rotation? UPDATE: Or vice versa of the above, though I'm leaning toward anchor = default, and pivot = rotation, better naming IMO. |
|
Howdy, looking into this issue one now. For a little clarification the |
Closing this as solved, pivot/anchor are working as intended. |
Sorry for bringing this up but I've been searching/reading through this repo and I'm still not clear on how to rotate a DisplayObjectContainer from the center. Using pivot is not allowing my container to flip from the center without moving elsewhere. Any ideas? I saw #93 and thought that was the answer, but maybe I'm not understanding it correctly. Any help would be appreciated. Thanks! Edit: I thought it would be helpful to mention that my object is moving across the screen and will be flipping while moving. I'm also using scale to do the "flipping". |
@mparker11 Rotating around a point and flipping (via Thoughts @GoodBoyDigital? |
@englercj Thanks for the response. I read an article about using matrix multiplication to achieve it, which I see that @GoodBoyDigital used in his |
Hmmm... Definitely don't understand how to use the pivot. I set the position of a sprite at a given position. Then I'd like to make it rotate at its center, so I set the pivot at the center of my sprite (sprite.width/2, sprite.height/2). This result in moving my sprite and having the rotation at 0,0. Uh? Did I miss something? |
@tleunen I believe you need to use anchor since you are using Sprites. |
Will this behavior be fixed in v4? I decided to try Pixi out and immediately hit this "bug". |
Neither is your comment I'm afraid. This is the way pixi deals with pivot. On Thursday, 10 March 2016, Ivan Kleshnin notifications@github.com wrote:
Mat Groves Technical Partner Telephone: 07708 114496 :: www.goodboydigital.com |
Please do not take "Not very helpful" personally.
I don't know whether it's a bug or not because I'm a noob in this industry. The main problem: after reading >10 related issues (here and on the internet) I still don't get how to workaround this behavior and force a container to rotate around it's center in defined point of space. |
Hi there! No worries man, sorry if I was a bit short, you caught me at the end of a long day! Pivot is meant to behave as a non normalised anchor point. The easiest way to fix it is to add the object into a container and rotate the container, whilst moving the object around internally. Hope that helps! |
No problem. Thanx. I'll try to use your advice. |
In my opinion, the easiest way to rotate a graphic (or a container) around its center point is to save the center point coordinates, where a graphic was drawn. Then, set the position and the pivot of the graphic to the center point. If you for example create a graphic object, you can start to draw primitives on it. The pivot property isn't buggy, it's just a little bit confusing to understand how it works and why it "affects object position". The object is always rotating around the own position and the pivot helps us to set a new point from where it rotates. |
Hello guys! Can I use the pivot with angles? I'm trying to modify the angle of one sprite (using the pivot to modify the rotation position) to follow the mouse, but I can't, can you help me, please? Check my codepen example => http://codepen.io/jdnichollsc/pen/KgdRvV?editors=0010 Thanks in advance, Nicholls |
Done! Only using pivot.y or pivot.x hahaha! Thanks for all Pixi team! 👍 |
Hey dude,I think that was a hack,cause it has a side effect: the position has been changed. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a question with regards to the pivot property of a DisplayObject. In particular, i want to rotate a DisplayObjectContainer around its center; so i set the pivot to its center point. However, i've noticed that this affects the position of the element.
For example, if i set the position to 0,0 (which is the default one) pixijs will try to position the object according to its center point and not the top left corner. So the children of the the DisplayObjectContainer (which in my case is an instance of the Graphics class) run out of the left and top edges of the viewport.
Is there any way to set the rotation point but still position the object in respect to its top left corner.
The text was updated successfully, but these errors were encountered: