File tree Expand file tree Collapse file tree
src/gameobjects/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,29 @@ var Origin = {
112112 return this . updateDisplayOrigin ( ) ;
113113 } ,
114114
115+ /**
116+ * Sets the origin of this Game Object based on the Pivot values in its Frame.
117+ *
118+ * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame
119+ * @since 3.0.0
120+ *
121+ * @return {Phaser.GameObjects.GameObject } This Game Object instance.
122+ */
123+ setOriginFromFrame : function ( )
124+ {
125+ if ( ! this . frame || ! this . frame . customPivot )
126+ {
127+ return this . setOrigin ( ) ;
128+ }
129+ else
130+ {
131+ this . originX = this . frame . pivotX ;
132+ this . originY = this . frame . pivotY ;
133+ }
134+
135+ return this . updateDisplayOrigin ( ) ;
136+ } ,
137+
115138 /**
116139 * Sets the display origin of this Game Object.
117140 * The difference between this and setting the origin is that you can use pixel values for setting the display origin.
You can’t perform that action at this time.
0 commit comments