SKFieldNode magneticNode吸引力 [英] SKFieldNode magneticNode attracting forces

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

问题描述

我目前正在使用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的某个人知道它,但那是四个测试版之前。

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 magneticNode吸引力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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