ios - physics body not inline with shape? -


for reason when apply physics body around skshapenode places physics body more left , downwards of actual shape though parameters of physics body comes shape. know why? thanks.

-(skshapenode*) createground1 {     //create rectangle     ground1 = [skshapenode shapenodewithrect:cgrectmake(0, 0, 300, 19)];     ground1.position = cgpointmake(800, 500);      //applies physics rectangle     ground1.physicsbody = [skphysicsbody bodywithrectangleofsize: cgsizemake(ground1.frame.size.width, ground1.frame.size.height)];     ground1.physicsbody.allowsrotation = false;     ground1.physicsbody.dynamic = false;     ground1.physicsbody.restitution = 0.0;      return ground1; } 

this happens because anchor points different. need define center point physics body this:

ground1.physicsbody = [skphysicsbody bodywithrectangleofsize:cgsizemake(ground1.frame.size.width, ground1.frame.size.height) center:cgpointmake(150, 9.5)]; 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -