Integrate bullet physical engine to ogre on iPhone

Source: Internet
Author: User

Write by nine days Yan Ling (jtianling) -- blog.csdn.net/vagrxie

Discuss newsgroups and documents

Why bullet?

Bullet
It is a popular 3D physical engine. After a few eyes, I learned some basic usage and found many 3D physical concepts and 2D (such as box2d) the concept is the same, and even some bullet usage is similar to box2d. After learning about it, I am concerned about the iPhone platform.
I chose bullet instead of other well-known physical engines, mainly from oolongengine
)
This engine was first created by Wolfgang. Engel and embedded with bullet support. How can I ignore this engine that is favored by all of the experts? He
The use of oolongengine also shows that bullet is no problem in iPhone. In addition, blender, a well-known 3D modeling tool
Bullet has direct support, which shows the popularity of bullet. In fact, there are still some stories, such as Erwin. coumans, one of oolongengine's project owners,
It is also the project creator and current owner of bullet. (To Google
Code to see it) and Erwin mentioned that bullet can run smoothly on the iPhone. Wolfgang provides a lot of help for floating point operations.
Do not optimize. The most interesting thing is that Disney used bullet for some of its projects. (According to the introduction on the homepage, at least Toy Story 3 used bullet for the game .)
Maya
Bullet plug-in. In order to return to the open-source community, this plug-in is already open-source ..... Thanks to bullet, Disney, and other open-source communities outside China ..... Ah
Well, this is a prosperous and sound development. You help me, I help you, the company is helped, and the Community is rewarded. After learning so many stories, I feel a lot more affection for bullet. Most worthwhile
It is mentioned that Erwin
It's just an open-source madman ..... He also initiated a gamekit
Open-source game engine project. We hope to integrate ogre/irrlicht and bullet. It is also worth looking forward to because it is a project created by Erwin .......
It has always been my fault to talk about it in other words .... That's it. Use the previous ogre on iPhone
The project started directly.

Compile bullet and ogrebullet in xcode


After downloading bullet, you can only use cmake to build a Mac OS.
X's project does not have the iPhone option, so let's take a look at the method of the Oolong engine, which is to copy the entire src directory to its own project, as if it was from the iPhone, this popular "Violence"
Use the source code ..... It can only be said that Apple's xcode development is not user-friendly, so the construction of the database is not as convenient as Vs, and the iPhone naturally does not support dynamic
Library is more conducive to this "brute force" use of source code, in fact, every time you modify the project file compilation will be much slower, helpless ..... On the bullet Forum, find the quasi-official solution of Erwin.
Is to copy all directories .... Khan one -_-!
In this case, everything is simple ..... Download the bullet source code
Currently, the latest version is 2.77. Copy the src directory and delete useless files, such as some cmake files. (Or copy the entire bullet directory directly from the Oolong engine, but the current version is 2.73) and configure the include directory of the bullet, compile, and everything is OK.

Now try to embed ogrebullet, the method still directly contains the source code. What's special is that ogrebullet needs to use bullet.
Convexdecomposition: the Library is in the extra of bullet, and the source code is also dragged over, and then the include directory is ready.

Test

Now in the test phase, we will use the ogrebullet tutorial
Medium
. All source code is copied. The only problem is that exampleapplication has some minor problems on the iPhone. Modify the function and solve the problem after namespace.
. Run-Time crash, check the problem, or the exampleapplication class problem, no wonder in the Ogre iPhone
The template does not use this class. The crash is very interesting. When OIS obtains the keyboard:
Mkeyboard = static_cast <ois: keyboard *> (minputmanager-> createinputobject (OIS: oiskeyboard, bufferedkeys ));
Notes are more interesting:
// Create all devices (we only catch joystick exceptions here, as, most people have key/mouse)
The typical reflection shows that the Code will never catch up with the changes of the Times. Since this class is no longer used, I will not bother using it. I will embed all the original example code into the ogreframework class.
Run, collapse, and discover new resources. Add the bumpymetal.jpg material and the cube. Mesh Model to the project. Run again, some of them are normal, and there is a picture of the truth:

When everything is okay, I find that my goal is the same as that of gamekit ..... Isn't it ogre + bullet? Erwin
I guess I already thought about what I think ..... Maybe it's good to try gamekit.

 

The author of the original article retains the copyright reprinted. Please indicate the original author and give a link

Write by nine days Yan Ling (jtianling) -- blog.csdn.net/vagrxie

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.