I am working on a small game that allows you to shoot a ball in a certain direction. The ball has to collide with a static body, and it does it just seems like the static body is trying to hide. The UIView shows up where I have placed it, but when I shoot the ball in that direction it collides with something invisible. Have I set the position using a wrong method?
Help much appreciated!
Thanks!
Code: Select all
-(void)createBoxWithView:(UIView *)physicalView{
b2BodyDef bd;
bd.type = b2_staticBody;
bd.userData = (__bridge void*)physicalView;
CGPoint center = [physicalView center];
bd.position.Set(center.x/PTM_RATIO, (self.view.frame.size.width - center.y)/PTM_RATIO);
b2Body *body = world->CreateBody(&bd);
b2PolygonShape box;
box.SetAsBox(10/PTM_RATIO, 10/PTM_RATIO);
b2FixtureDef fd;
fd.shape = &box;
body->SetType(b2_staticBody);
body->CreateFixture(&fd);
}Help much appreciated!
Thanks!