Setting Pivot still makes no orderly sense
See original GitHub issuepixi.min.4.5.js
I saw all of the discussion about Pivot Origin Hotpoint Anchor and so on for points to spin an object around. Those were from V3, v4 is out and v5 on the way like and pivot still moves objects. Like Why!?
First though is the documentation about it. Its tooooooo short and so not helpful. “The pivot point of the displayObject that it rotates around Assignment by value since pixi-v4.”
Is this is a normalized unit or pixel at local unit? It should be nice and clear to everyone reading it.
Paper.js you can pass a rotation point to the rotation function. That works a treat! You can also simply set the pivot pointer and it will use that object as its rotation from there on
Three.js you have a lot of ways to do things. Quaternions take an axis and use its position point. If you need to offset the geometry you just do it once and spin away!
If I could get the geometry vertices of a sprite or rect I could do it the GL or THREE way and just offset stuff via matrixes. I don’t see how to do that in the docs either.
Maybe if there was a simple formula on the docs that showed how to set the pivot to the center.
Right now I’m trying a simple obvious reset to 0,0 calculate the center move it to that
a = sprite.getBounds()
sprite.position.set(0,0)
sprite.pivot.set(a.width/2,a.height/2)
that just nudged it a tiny bit, gawH?! Check position sprite.position x-> 0y ->0 Hrrrmmmm, so its offsetting the geometry a bit like an applyMatrix() But not the super correct and obvious behavior offset.
if I just put an eyeball value and try to then move it back yet more weirdness
sprite.pivot.set(a.width*2,a.height*2)
sprite.position.set(a.x,a.y)
it uses the pivot as its position point now and moves to it the previous center but thats not its position member thats its pivot no wait its both but that positions values are not. GLLLAG
Im sure this is easy to the devs that know it, the docs need a clean simple example mixed in for this. I don’t want to purpose some huge under the hood fix. Just super small example codes that are easy to find for all dev when reading the docs so we don’t waste your time with pointless issues
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6
Top GitHub Comments
Not 100% what your expectation is here so I’m guessing that its rotating the scaled sprite around its center. No need to reset scale, just take it into account when setting the pivot;
https://jsbin.com/tegejasema/1/edit?html,output
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.