Box2d in cocos2d-x (5)-Gear

Source: Internet
Author: User

Fill (Bill man) Personal originality. You are welcome to repost it. Please specify the address for reprinting (Bill man) Column addressHttp://blog.csdn.net/bill_man

This example, like its name, mainly creates a gear joint. The effect is as follows:

First, insert a content. Here we provide a method to create other types of shapes. The method is as follows:

The above are the methods for creating circles and polygon and using these shapes to create objects.

In theory, complex shapes can be used to simulate the gear joints, but this is not efficient.Box2dProvidedGear joint. Similar to the pulley coefficient, you can specify a gear coefficient (ratio), and the gear coefficient can be negative. It is also worth noting that when one is a rotating joint (angular) and the other is a moving joint (PAN), the gear coefficient is one of the length or length points. It should be noted that the gear joint should always be removed before rotation or moving the joint, otherwise yourCodeIt will crash due to invalid joint pointer in the gear joint. In addition, the gear joint should be deleted before any related objects are deleted. The following describes how to define the gear joints.

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

Next articleCantileverExample

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.