ios - How to tell height of a sprite after zrotation? -


i have sprite this:

enter image description here

let sprite = skspritenode(imagenamed: "sprite.png") print("sprite height: \(sprite.size.height)") //results 150  sprite.zrotation = 90 * degreestoradians //turns sprite 90 degrees 

results this:

enter image description here however:

print("sprite height: \(sprite.size.height)") //results 150 

sprite height still 150 though takes far less space height-wise.

is there way actual height of sprite after zrotating it? know work around in example above real problem have various sprites @ various zrotations , i'm trying make sure of them visible on screen.

so have sprite (red bar), anchor point @ 0,0 (blue dot) , visible screen (black frame).

enter image description here

i zrotate sprites random angles using arc4random_uniform sprites end not being visible on screen. have know height of green arrow or assign anchorpoint after zrotation. or perhaps there other ways have not thought of. appreciated!

enter image description here

0x141e's comment works.

sprite.frame.size.height   

results correct outcome.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -