简体   繁体   English

Cocos2d Touch Bezier(cocos2d V3)

[英]Cocos2d Touch Bezier (cocos2d V3)

There is a way to create chipmunk shape (physic body) from touches (curves)? 有一种方法可以通过触摸(曲线)创建花栗鼠形状(实体)? I mean, that I can just create some shape from points, but there is a limitation to the number of vertices and the shape of the figure is angular, rather than convex. 我的意思是,我只能从点创建一些形状,但是顶点的数量受到限制,并且图形的形状是有角的,而不是凸的。 I found some info about Bezier, but it is compatible only with old version of cocos2d, but I have to find something for cocos2d V3. 我找到了一些有关Bezier的信息,但仅与旧版本的cocos2d兼容,但是我必须为cocos2d V3找到一些信息。

It works for me: 这个对我有用:

CCDrawNode *node = [CCDrawNode node];
[node drawPolyWithVerts:points count:count fillColor:[CCColor redColor] borderWidth:2 borderColor:[CCColor redColor]];
node.physicsBody = [CCPhysicsBody bodyWithPolylineFromPoints:points count:count cornerRadius:2 looped:YES];

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM