更改Box2D锚点? [英] Change Box2D Anchor Point?
问题描述
在Cocos2D中,我创建锚点为(0,1)的CCSprite,这与UIKit的方式类似。无论如何,我正在尝试在Box2D中更改锚点,这可能吗?
如果是这样,我将如何以(0,1)的锚点进行操作?
In Cocos2D I am creating my CCSprites with anchor points of (0,1) which is similar to the way UIKit does it. Anyway, I am trying to change the anchor point in Box2D, is this possible? If so how would I do it with an anchor point of (0,1)?
谢谢!
推荐答案
Box2D实体没有锚点。
Box2D bodies don't have an anchor point.
anchorPoint是节点纹理相对于节点位置的偏移量。 Box2D实体没有纹理,因此没有锚点。
The anchorPoint is an offset of a node's texture relative to the node's position. Box2D bodies don't have a texture, hence no anchor point.
通常来说,将anchorPoint的默认位置更改为0.5,0.5会使很多事情变得更加困难。例如,导致您问这个问题的问题。
Generally speaking you're going to make a lot of things more difficult by changing the anchorPoint from its default 0.5,0.5 position. Like, for example, the issue that lead you to ask this very question.
这篇关于更改Box2D锚点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!