SKFieldNode 磁节点吸引力 [英] SKFieldNode magneticNode attracting forces

查看:17
本文介绍了SKFieldNode 磁节点吸引力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 iOS 8 SpriteKit API,并且很难使用 SKFieldNode 创建有吸引力的磁力.我可以很好地产生相反的磁力,但是我不能反转磁场.这是我目前拥有的:

I am currently working with the iOS 8 SpriteKit API's and am having a hard time creating an attractive magnetic force with SKFieldNode. I can create an opposing magnetic force just fine, however I can't reverse the field. Heres what I have currently:

    touchField = [SKFieldNode magneticField];

    touchField.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:(self.frame.size.height/4 - 34)];

    touchField.physicsBody.charge = 3;

这个特定字段应该与另一个 SKSpriteNode 交互.

This particular field is supposed to be interactive with another SKSpriteNode.

推荐答案

从 iOS 8.1 开始,电磁场目前已损坏.它们根本不与物理模拟交互.

Electric and Magnetic fields are currently broken, as of iOS 8.1. They don't interact with the physics simulation at all.

可能导致您的其他节点移动的原因是它的物理主体位于您附加到场的主体内部,模拟通过将节点分开来进行纠正.

What's probably causing your other node to move is that its physics body is inside the body you've attached to your field, which the simulation corrects by moving the nodes apart.

另外值得注意的是,如果磁场正常工作,您不需要向其中添加物理体 - 场节点本身足以获得效果.

Also of note is that if magnetic fields were working properly, you don't need to add a physics body to it - the field node itself is intended to be enough to get the effect.

我已向 Apple 提交了一份未解决的错误报告.提交重复项会提高错误的优先级,因此如果您提交一个,请提及它是错误 18785194 的副本.

I've got an open bug report filed with Apple. Filing duplicates increases a bug's priority, so if you file one, mention that it's a duplicate of bug 18785194.

更新:这个错误仍然存​​在于 iOS 8.3/Xcode 6.3 beta 2 中.我收到了关于我的错误报告的更多信息的请求,所以至少 Apple 有人知道它,但那是四个 beta 版本之前.

UPDATE: This bug still exists in iOS 8.3/Xcode 6.3 beta 2. I've received a request for more information on my bug report, so at least somebody at Apple is aware of it, but that was four beta versions ago.

更新 2:此错误已在 iOS 9.0/Xcode 7.0 beta 2 中部分解决.电场和磁场现在可以工作,但自定义字段仍然无法使用.

UPDATE 2: This bug is partially resolved with iOS 9.0/Xcode 7.0 beta 2. Electric and magnetic fields now work, but custom fields are still broken.

这篇关于SKFieldNode 磁节点吸引力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆