gpt4 book ai didi

ios - 为什么我不能在 SpriteKit 中向场景 physicsWorld 添加关节

转载 作者:可可西里 更新时间:2023-11-01 04:13:56 26 4
gpt4 key购买 nike

我正在尝试向场景 physicsWorld 属性添加一个关节,但我收到了 EXC_BAD_ACCESS。这是我正在使用的代码。

SKPhysicsJointFixed *fixedJoint = [SKPhysicsJointFixed jointWithBodyA:self.mousePoint.physicsBody bodyB: self.box.physicsBody anchor:touchPoint];

[self.physicsWorld addJoint:fixedJoint]; // Error happens here.

我在触摸开始时调用它。有谁知道这是怎么回事吗?

最佳答案

我遇到了和你一样的问题,答案很简单,只需将节点添加到场景中,然后再将其添加到物理世界。

关于ios - 为什么我不能在 SpriteKit 中向场景 physicsWorld 添加关节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21352978/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com