Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 雪碧与屏幕底部碰撞?_Ios_Iphone_Collision_Sprite Kit_Skphysicsbody - Fatal编程技术网

Ios 雪碧与屏幕底部碰撞?

Ios 雪碧与屏幕底部碰撞?,ios,iphone,collision,sprite-kit,skphysicsbody,Ios,Iphone,Collision,Sprite Kit,Skphysicsbody,我的场景有一个[SKPhysicsBody WithEdgeloopFromRect:self.frame]。当精灵仅与屏幕底部发生碰撞时,如何执行操作?因此,使用`SKPhysicsBody的bodywithedgecompoint:toPoint:消息创建一个仅代表屏幕底部的实体。比如: const int buffer = 100; SKPhysicsBody *myBody = [bodyWithEdgeFromPoint:CGPointMake(-buffer, screenHeigh

我的场景有一个
[SKPhysicsBody WithEdgeloopFromRect:self.frame]
。当精灵仅与屏幕底部发生碰撞时,如何执行操作?

因此,使用
`SKPhysicsBody
bodywithedgecompoint:toPoint:
消息创建一个仅代表屏幕底部的实体。比如:

const int buffer = 100;
SKPhysicsBody *myBody = [bodyWithEdgeFromPoint:CGPointMake(-buffer, screenHeight) toPoint:CGPointMake(screenWidth + buffer, screenHeight)];

请注意缓冲区,以防止东西从“边缘”脱落,直到它们完全脱离屏幕(更改常量以适合您的用例)。

您应该添加节点来表示底部边缘,并将物理体添加到该节点。抓住那个身体上的碰撞。