Show DopePlano.cpp syntax highlighted
#include "DopePlano.h"
#include "DopeEscena.h"
namespace Dope
{
//-------------------------------------------------------------------------
Plano::Plano(const String& name, Real width, Real height) : Entidad(name)
{
mWidth = width;
mHeight = height;
setUp(name);
}
//-------------------------------------------------------------------------
Plano::~Plano()
{
}
//-------------------------------------------------------------------------
void Plano::setUp(const String& name)
{
// Create visual presence
SceneManager* sm = Escena::getSingleton().getSceneManager();
mEntity = sm->createEntity(name, "Prefab_Plane");
mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name);
mSceneNode->attachObject(mEntity);
// Add reverse reference
mEntity->setUserObject(this);
// Default plane is 100x100
mSceneNode->scale(mWidth / 100.0f, mHeight / 100.0f, 1.0);
// No mass body (considered static)
// Create collision proxy
// SpaceID is irrelevant, we're doing our own spacial partitioning
// WARNING: an ODE dPlane seems to barf badly when you setPosition on it! Use a box.
// The other benefit here is that it reflects the width / height of the plane, not infinite
dBox* odeBox = new dBox(0, mWidth*2, mHeight*2, 1);
mCollisionProxies.push_back(odeBox);
updateCollisionProxies();
}
}
See more files for this project here