Cocos2d Study Notes (10) Physical engine box2d 4

Source: Internet
Author: User

Today, let's take a look at how to create an irregular shape.

In box2d, you can set multiple vertex for a shape, so that you may generate a custom shape, such

In this way, a custom shape is created. Note the following when creating a custom shape:

1. the vertex position is relative to the center of the body

2. the vertex needs to be defined clockwise.

3. the maximum number of vertices cannot exceed 8. The larger the number, the more expensive the memory, the worse the performance.

4. A concave cannot be defined for a vertex)

What is concave and convex?

There is a small tool used to get the vertex value, called vertex helper ,:Https://github.com/jfahrenkrug/VertexHelper

You need to use xcode to open the file. After opening the file, drag your image to vertex helper, click Edit mode, select box2d for type, select initialization for style, and click on the image with the mouse.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.