Author Topic: X_SPRITE scaling  (Read 44 times)

Qedo

• Mr. Polyvector
• Posts: 196
• UNUS SED LEO
X_SPRITE scaling
« on: 2020-Mar-25 »
I'm not sure but I suspect that the scaling parameter of X_SPRITE is incorrect.
I try to explain in the simplest way possible what I did to verify
I created a yellow sprite of size 640x480 with horizontal and vertical black lines spaced 100 pixels between them.
I placed this natural size X_SPRITE (scaling = 1) at the origin of the scene x = 0 z = 0 with downward movement to y = -240 (half its height)
I would have expected the positioning of the center of the sprite to correspond with the center of the axes but instead the result is as shown in figure 1
To obtain the positioning of the sprite centered on the axes I must instead move it down -120 as in figure 2
To justify the results obtained, the only logic that comes to mind is that the X_SPRITE is drawn not with scaling = 1 but instead with scaling = 0.5. that is, half of its size
This is my theory. I don't know if anything escapes me and I'm asking for your opinion  and your experience.
I didn't create this thread in BUG  just because I'm not sure it is
Thank you
Ciao

Kitty Hello

• code monkey
• Prof. Inline
• Posts: 10732
• here on my island the sea says 'hello'
Re: X_SPRITE scaling
« Reply #1 on: 2020-Mar-26 »
IIRC - it's quite some time - the top coordinate for X_SPRITE is the top center of the sprite. Sort of - like the 2D SPRITE commands, but X centered.

Qedo

• Mr. Polyvector
• Posts: 196
• UNUS SED LEO
Re: X_SPRITE scaling
« Reply #2 on: 2020-Mar-26 »
I'm confused. the manual says about X_SPRITE:

"Draws a 2D sprite at a 3D position. This technique is also known as Billboarding. The hot spot of the sprite (the part which will be drawn at the give location) is the sprite's bottom center."

also if it were how you write:

"the top coordinate for X_SPRITE is the top center of the sprite. Sort of - like the 2D SPRITE commands, but X centered."

the behavior of the program would be completely inexplicable.
Have you tried the example attached?