Sprite help

Can someone explain what .origin and .anchor do/mean?

I haven't a clue and haven't been able to find out.
According to the MV helpfile, anchor = origin. But the RPG Maker helpfile is kinda bad in general (doesn't explain what the origin does or is used for/by) so I took this quote from the Microsoft helpfile instead:

 

Sprite OriginWhen you draw a sprite, the sprite origin is an important concept. The origin is a specific point on the sprite, which is by default the upper-left corner of the sprite, or (0,0). Draw draws the origin of the sprite at the screen location you specify. For example, if you draw a 50×50 pixel sprite at location (400,200) without specifying an origin, the upper left of the sprite will be on pixel (400,200). If you use the center of the 50×50 sprite as the origin (25,25), to draw the sprite in the same position you must add the origin coordinates to the position. In this case, the position is (425,225) and the origin is (25,25).

When rotating a sprite, the method uses the origin as the center of the rotation. In these cases, it is common to use the center of the sprite as the origin when calculating where to draw the sprite on the screen.
The above pretty much also applies to RPG Maker. Just place a sprite (without rotation) and change it's origin and you will see what happens (it should change location I guess).

I don't know if the MV rotation also uses the origin but I suppose it does. This is also not explained in the helpfile and you must find out through experience/trial-and-error... In fact most things in RPG Maker = trial-and-error imo.

Sprite inherits from PIXI.Sprite and pixi.js can be opened but I gotta warn you, you have to backtrack a LOT of functions here to find out where the (cross)origin is actually used. At least this library is properly documented, but it's not made by the RPG Maker team so that explains.

This info should have been (more detailed) in the rpg maker helpfile as well as in the Sprite-class.
PIXI.Sprite

pixi.js:2338 function (texture)

{

    PIXI.DisplayObjectContainer.call( this );

 

    /**

     * The anchor sets the origin point of the texture.

     * The default is 0,0 this means the texture's origin is the top left

     * Setting than anchor to 0.5,0.5 means the textures origin is centered

     * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner

     *

     * @property anchor

     * @type Point

     */

    this.anchor = new PIXI.Point();
Ok I understand now. Thanks all

Original thread: https://forums.rpgmakerweb.com/threads/sprite-help.53063/