question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting Pivot still makes no orderly sense

See original GitHub issue

pixi.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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
staff0rdcommented, Sep 2, 2017

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;

var bounds = sprite.getBounds();
sprite.pivot.set(bounds.width/2/sprite.scale.x, bounds.height/2/sprite.scale.y);

https://jsbin.com/tegejasema/1/edit?html,output

0reactions
lock[bot]commented, Feb 24, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Pivot still makes no orderly sense · Issue #3961 · pixijs ...
The issues still stand though, setting a pivot should not move an object. Afterwards treating the pivot as its position point makes fine...
Read more >
Pivot Table Sorting Fixes & Tips - Contextures
How to fix Excel pivot table sorting problems- new items at end, wrong items at top. Sort by column or row, custom order....
Read more >
Pivot Table Column Heading can no longer be moved
Pivot Table Column Heading can no longer be moved. In Excel 2011, I had no issues trying to change the order of the...
Read more >
Qlik Sense Wrong Sorting in Pivot Table? - YouTube
(this also applies for QlikView). Pivot tables may appear to sort wrongly when sorted by value and you have child nodes of the...
Read more >
10 pivot table problems and easy fixes - YouTube
With pivot tables, it's often the little things that are frustrating. In this short video we look at 10 pivot common pivot table...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found