objective c - SKShapeNode.Get Radius? -


is possible skshapenode's radius value?

the problem is, need create identical circle after user releases it, whilst removing first circle view.

    skshapenode *reticle = [skshapenode shapenodewithcircleofradius:60];     reticle.fillcolor = [uicolor colorwithred:0 green:0 blue:0 alpha:0.3];     reticle.strokecolor = [uicolor clearcolor];     reticle.position = cgpointmake(location.x - 50, location.y + 50);     reticle.name = @"reticle";     reticle.userinteractionenabled = yes;     [self addchild:reticle];      [reticle runaction:[skaction scaleto:0.7 duration:3] completion:^{         [reticle runaction:[skaction scaleto:0.1 duration:1]];     }]; 

then

-(void)touchesended:(nsset *)touches withevent:(uievent *)event { ....     sknode *node = [self childnodewithname:@"reticle"];      //take position of node, draw imprint      /////////here need circle radius.      [node removefromparent];  } 

how 1 take circle radius, can say

skshapenode *imprint = [skshapenode shapenodewithcircleofradius:unknownvalue]; 

i've tried, making exact copy of circle

skshapenode *imprint = (skshapenode *)node; 

however, still follows animation need stop, @ point at. don't want take "stopallanimations" approach.

you can use shape node's path property determine bounding box of shape cgpathgetboundingbox(path). bounds, can compute radius of circle dividing width (or height) 2. example,

cgrect boundingbox = cgpathgetboundingbox(circle.path); cgfloat radius = boundingbox.size.width / 2.0; 

Comments

Popular posts from this blog

c++ - Qt setGeometry: Unable to set geometry -

python - argument must be rect style object - Pygame -

How to resolve Delphi error: Incompatible types: 'PWideChar' and 'Pointer' -