First of all … u need to export a scene from 3dsmax using octopus … with linked ODE Bodies and OGRE Meshes …

//this variables u need for the code snippet
SharedPtr<physics::IWorld>             m_pWorld;
SharedPtr<graphics::IWorld>            m_gWorld;
SharedPtr<app::model::Graphical>       mGrMap;
SharedPtr<app::model::Physical>        mPhyMap;
SharedPtr<app::model::complex::Model>  mMapModel;
yake::String                           sceneMapName;
yake::String                           xodeMapName, 
yake::String                           linkMapName,
//****************
//i will not explain world/camera/viewport creation because it's not a tutorial :P
//u need to add cam/world creation here
//****************
//this is the method
//loading graphical part
if (mGrMap.get()!=NULL) {
	mGrMap.reset();
}
mGrMap.reset(new app::model::Graphical());
YAKE_ASSERT(mGrMap);
mGrMap->fromDotScene(sceneMapName, m_gWorld);
//loading physical part
if (mPhyMap.get()!=NULL) {
	mPhyMap.reset();
}
mPhyMap.reset(new app::model::Physical());
YAKE_ASSERT(mPhyMap);
yake::data::dom::xml::XmlSerializer ser;
ser.parse(xodeMapName, false);
YAKE_ASSERT(ser.getDocumentNode())(xodeMapName).error("Could not load XODE document...");
 
yake::data::parser::xode::XODEParserV1 parser(*mPhyMap);
parser.load(ser.getDocumentNode(), m_pWorld);
 
//bring it all together
mMapModel = SharedPtr<app::model::complex::Model>(new app::model::complex::Model());
mMapModel->addGraphical(mGrMap, "baseGraphical");
mMapModel->addPhysical(mPhyMap, "basePhysical");
 
app::model::DotLinkLoader dotLinkLoader;
dotLinkLoader.load(linkMapName, *mMapModel.get());
//end loading and settup stuff
//***************************
//add this to run cycle ...
m_pWorld->step(0.01);
mMapModel->updateControllers(delta);
//***************************
//after this the physics will be computed 
//
 
codesnippets/physics.txt · Last modified: 2008/02/21 21:54 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki