ios - How to tell height of a sprite after zrotation? -
i have sprite this:
let sprite = skspritenode(imagenamed: "sprite.png") print("sprite height: \(sprite.size.height)") //results 150 sprite.zrotation = 90 * degreestoradians //turns sprite 90 degrees
results this:
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).
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!
0x141e's comment works.
sprite.frame.size.height
results correct outcome.
Comments
Post a Comment