This lab, part A in particular, is heavily based on an Ogre physics example provided by Nikhilesh Sigatapu. Nikhilesh created a thin Bullet Physics Simulation wrapper for Ogre, which makes setting up physical objects very straight-forward. This wrapper is called btOgre and the example we will use is contained within that package. Other sources of information include of course the Bullet Physics Documentation and Wiki.
Discussion thread for this lab is here: Lab 7 Discussion Thread
The goal of this lab is to understand how you can integrate a physics simulation with Ogre and understand what such a simulation can provide.
Preparation steps are provided below.
Follow these steps to complete the lab project:
bullet-2.81
as you are not likely to worry about specific revisions.<yoursdkfolder>\bullet-2.81\build\vs2010\0BulletSolution.sln
<yoursdkfolder>\bullet-2.81
folder and execute App_HelloWorld_vs2010_debug.exe
from the command line. You should see numbers printed out on the screen.<yoursdkfolder>\bullet-2.81\Demos\HelloWorld
. Appreciate the fact that there are no graphics, and yet we have dynamic objects being simulated ;)<yoursdkfolder>\OgreSDK_vc10_v1-8-1\boost; <yoursdkfolder>\bullet-2.81\src
<yoursdkfolder>\OgreSDK_vc10_v1-8-1\boost\lib; <yoursdkfolder>\bullet-2.81\lib
BulletDynamics_vs2010_debug.lib;BulletCollision_vs2010_debug.lib;LinearMath_vs2010_debug.lib
TestLevel_b0.mesh
as the groundEntity instead of the simple plane. Try that (you can accomplish that by commenting out three lines and un-comment one line ;)).Prop(SceneManager* sceneMgr, const Ogre::String& mesh, Vector3 pos, Vector3 scale, btScalar mass)
And then to create one star in createScene
you would simply do:
Prop* mystar = new Prop(mSceneMgr, "Star.mesh", Vector3(0,10,0), Vector3(1,1,1), 5);
When you implement this class, be aware that Ogre allows you to omit providing an entity name and a scene node name when you create those. Ogre will then simply provide unique names of its own (useful when you want to create multiple instances of this object). Make sure that your class also implements a destructor that deletes the object properly (in the example, you see how the object is deleted in the BtOgreTestApplication destructor). When you have implemented the Prop class, test it by creating two instances of the star.
frameStarted
method of the BtOgreTestFrameListener
and respond to that state by creating a new instance of the star. You should now be able to easily fill the world with bouncing stars!Upload your commented source files into Lab6 in MySchool (zip them up if more than one). The lab projects will not be graded, but their completion counts towards your participation grade.