我有一个SKSpriteNode
看起来像梯形的,代码如下:
bezierPath = [UIBezierPath bezierPath];
[bezierPath moveToPoint:CGPointMake(0, 0)];
[bezierPath addLineToPoint:CGPointMake(90, 90)];
[bezierPath addLineToPoint:CGPointMake(374, 90)];
[bezierPath addLineToPoint:CGPointMake(462, 0)];
CGPathRef path2 = bezierPath.CGPath;
self.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:path2];
self.physicsBody.dynamic = NO;
我记得在某处读到 SKSpriteNode 必须是凸的,而且这个形状肯定看起来是凸的。程序中发生的情况是,当车辆驶过这个梯形凸块时,似乎发生的是车辆低于梯形形状。谁能帮我解决这个问题?