Box2d in cocos2d-x (2)-tumbler

Source: Internet
Author: User

Small man (Bill man) Personal Original, welcome to reprint, reprint please indicate the address, small man (Bill man) column address http://blog.csdn.net/bill_man

First, let's talk about the tumbler example. First, let's take a look at the running effect.

Drop some small blocks from one point down, and then the entire box is rotated.

The first step is to create an external box, set the type to dynamic type, allow sleep, set the position, and the last half is to set four edges for the object.

Set a rotating motor so that the object can be turned around a point. Set the maximum torque 1e8f to keep the motor at a stable speed. When the maximum torque is exceeded, the motor will slow down and stop.


Then, a small object is generated in each time step, which is generated at 0.0f and 10f and is a square.

If there are any errors, I hope you can correct them more.

The next article describes the tiles example.

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.