[英]How to scale physicsBody?
When I scale a CCSprite with a physicsbody attached the physics body doesn't scale (I have debugDraw on). 当我使用物理体附加缩放CCSprite时,物理体不会缩放(我有debugDraw)。 How do I scale the physicsBody?
如何缩放物理体?
I found this code to change the radius of a circular physical body but it doesn't work on cocos2d v3.. 我发现这个代码改变了圆形物理体的半径,但它不适用于cocos2d v3 ..
for(ChipmunkCircleShape* newShape in self.chipmunkObjects)
{
if([newShape isKindOfClass:[ChipmunkCircleShape class]]) {
cpCircleShapeSetRadius([newShape shape],[newShape radius]*scale); // Unsafe Resize
cpCircleShapeSetOffset([newShape shape],ccpMult([newShape offset],scale));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.