swift - Floats SpriteKit -



swift - Floats SpriteKit -

why spritekit utilize floats position though there can't decimal point in pixels?

i building game in spritekit , wondering whether should create character position in ints optimize not sure whether there performance improvements.

is worth converting character positions ints optimize?

in general, it's simpler utilize floats integers when dealing graphics above bit-twiddling level. note core graphics uses floats coordinates.

the reason it's simpler want things scale (by non-integer factor) , rotate coordinates, images, paths, etc. if utilize integers, rounding errors accumulate noticeable amount quickly. if utilize floats, rounding errors take much longer become noticeable - don't become noticeable @ all.

also consider sknode has xscale , yscale properties. if scale node, fractional part of children's positions can have big effect on positions on screen.

you should not convert character positions ints. spritekit uses floats, you'll end converting them floats utilize them spritekit, cpu has floating point support, , gpu designed perform massive amounts of floating point arithmetic.

swift floating-point sprite-kit

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -