Ejemplo n.º 1
0
void Player::kill(std::string s)
{
    Mix_Chunk* chunk;
    chunk = Mix_LoadWAV("Music/0/death.wav");
    Mix_PlayChannel( -1, chunk, 0 );
    health = 0;
    Ogre::Entity* mEntity = static_cast<Ogre::Entity*>(rootNode->getAttachedObject(0));
    if(s.compare("Cube/deathNormal") == 0)
    {
        mEntity->setMaterialName(s); 
    }
    else if(s.compare("Cube/deathSpike") == 0)
    {
         mEntity->setMaterialName(s); 
    }
    else if(poison)   
    {       
        mEntity->setMaterialName("Cube/DeathPoison");       
    }       
    else if(burn>0)     
    {       
         mEntity->setMaterialName("Cube/DeathFire");        
    }       
    else if(oxygen<=0)      
    {       
        mEntity->setMaterialName("Cube/DeathDrown");        
    }
}
Ejemplo n.º 2
0
void StencilShadowTest::setupContent()
{
    // turn ambient light off
    mSceneMgr->setAmbientLight(ColourValue(0.0, 0.0, 0.0));

    // turn on stencil shadows
    mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
    
    // add a couple lights
    Ogre::Light* light = mSceneMgr->createLight("Light1");
    light->setDiffuseColour(0.5f,0.4f,0.35f);
    light->setSpecularColour(0, 0, 0);
    light->setAttenuation(8000,1,0.0005,0);
    light->setPosition(220,100,0);
    light->setCastShadows(true);
    light->setType(Light::LT_POINT);
    light = mSceneMgr->createLight("Light2");
    light->setDiffuseColour(0.5f,0.4f,0.35f);
    light->setSpecularColour(0, 0, 0);
    light->setAttenuation(8000,1,0.0005,0);
    light->setPosition(220,100,-200);
    light->setCastShadows(true);
    light->setType(Light::LT_POINT);
    
    // create a ground plane to receive some shadows
    Plane pln = MovablePlane("plane");
    pln.normal = Vector3::UNIT_Y;
    pln.d = 107;
    MeshManager::getSingleton().createPlane("ground_plane",
        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, pln,
        1500,1500,50,50,true,1,5,5,Vector3::UNIT_Z);
    Ogre::Entity* groundPlane = mSceneMgr->createEntity( "plane", "ground_plane" );
    groundPlane->setMaterialName("Examples/Rocky");
    groundPlane->setCastShadows(false);
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundPlane);

    // and a couple objects to cast the shadows
    Ogre::Entity* bar = mSceneMgr->createEntity( "barrel", "Barrel.mesh" );
    bar->setCastShadows(true);
    Ogre::SceneNode* barNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    barNode->attachObject(bar);
    barNode->setScale(7,7,7);
    barNode->setPosition(Ogre::Vector3(0,-85,-320));
    Ogre::Entity* head = mSceneMgr->createEntity( "ogrehead", "ogrehead.mesh" );
    head->setCastShadows(true);
    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    headNode->attachObject(head);
    headNode->setPosition(Ogre::Vector3(-100,-80,-320));
    Ogre::Entity* torus = mSceneMgr->createEntity( "torus", "knot.mesh" );
    torus->setCastShadows(true);
    torus->setMaterialName("Examples/RustySteel");
    Ogre::SceneNode* torusNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    torusNode->setScale(0.5,0.5,0.5);
    torusNode->attachObject(torus);
    torusNode->setPosition(Ogre::Vector3(100,-60,-320));
    
    // point the camera down a bit
    mCamera->pitch(Ogre::Degree(-20.f));
}
Ejemplo n.º 3
0
bool HydraxSample1App::keyPressed(const OIS::KeyEvent &arg)
{
/*
	if (arg.key == OIS::KC_Q)
	{
		mCurrentSkyBox++;
		if (mCurrentSkyBox == 3)
		{
			mCurrentSkyBox = 0;
		}
	}
	mSceneMgr->setSkyBox(true,mSkyBoxes[mCurrentSkyBox],1000,true);

	mHydrax->setSunPosition(mSunPosition[mCurrentSkyBox]);
	mHydrax->setSunColor(mSunColor[mCurrentSkyBox]);

	mSceneMgr->getLight("Light0")->setPosition(mSunPosition[mCurrentSkyBox]);
	mSceneMgr->getLight("Light0")->setSpecularColour(mSunColor[mCurrentSkyBox].x,mSunColor[mCurrentSkyBox].y,mSunColor[mCurrentSkyBox].z);*/

	if (arg.key == OIS::KC_1 || arg.key == OIS::KC_2 || arg.key == OIS::KC_3)
	{
		CEGUI::Point point = CEGUI::MouseCursor::getSingleton().getPosition();
		Ogre::Ray ray = mCameraMan->getCamera()->getCameraToViewportRay(point.d_x/mWindow->getWidth(),point.d_y/mWindow->getHeight());
		mRaySceneQuery->setRay(ray);
		Ogre::RaySceneQueryResult * mRayQueryResult = &(mRaySceneQuery->execute());

		Ogre::RaySceneQueryResult::iterator itr = mRayQueryResult->begin();
		while(itr != mRayQueryResult->end())
		{
			if(itr->worldFragment)
			{
				Ogre::Entity * ent;
				Ogre::SceneNode * node;
				if (arg.key == OIS::KC_1)
				{			
					ent = mSceneMgr->createEntity(entityNames[0]);
					ent->setMaterialName(materialNames[0]);
					node = mSceneMgr->getRootSceneNode()->createChildSceneNode(itr->worldFragment->singleIntersection + Ogre::Vector3(0,200,0));
				}
				else if (arg.key == OIS::KC_2)
				{
					ent = mSceneMgr->createEntity(entityNames[1]);
					ent->setMaterialName(materialNames[1]);
					node = mSceneMgr->getRootSceneNode()->createChildSceneNode(itr->worldFragment->singleIntersection);
				}
				else if (arg.key == OIS::KC_3)
				{
					ent = mSceneMgr->createEntity(entityNames[2]);
					ent->setMaterialName(materialNames[2]);
					node = mSceneMgr->getRootSceneNode()->createChildSceneNode(itr->worldFragment->singleIntersection);
				}
				node->attachObject(ent);
				break;
			}
			itr++;
		}
	}
	return true;
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------------
void Sample_Compositor::setupScene(void)
{
	mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
	mSceneMgr->setShadowFarDistance(1000);
    
	Ogre::MovableObject::setDefaultVisibilityFlags(0x00000001);

	// Set ambient light
	mSceneMgr->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.2));

	Ogre::Light* l = mSceneMgr->createLight("Light2");
	Ogre::Vector3 dir(-1,-1,0);
	dir.normalise();
	l->setType(Ogre::Light::LT_DIRECTIONAL);
	l->setDirection(dir);
	l->setDiffuseColour(1, 1, 0.8);
	l->setSpecularColour(1, 1, 1);


	Ogre::Entity* pEnt;

	// House
	pEnt = mSceneMgr->createEntity( "1", "tudorhouse.mesh" );
	Ogre::SceneNode* n1 = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(350, 450, -200));
	n1->attachObject( pEnt );

	pEnt = mSceneMgr->createEntity( "2", "tudorhouse.mesh" );
	Ogre::SceneNode* n2 = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(-350, 450, -200));
	n2->attachObject( pEnt );

	pEnt = mSceneMgr->createEntity( "3", "knot.mesh" );
	mSpinny = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(0, 0, 300));
	mSpinny->attachObject( pEnt );
	pEnt->setMaterialName("Examples/MorningCubeMap");

	mSceneMgr->setSkyBox(true, "Examples/MorningSkyBox");


	Ogre::Plane plane;
	plane.normal = Ogre::Vector3::UNIT_Y;
	plane.d = 100;
	Ogre::MeshManager::getSingleton().createPlane("Myplane",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		1500, 1500, 10, 10, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
	Ogre::Entity* pPlaneEnt = mSceneMgr->createEntity( "plane", "Myplane" );
	pPlaneEnt->setMaterialName("Examples/Rockwall");
	pPlaneEnt->setCastShadows(false);
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);

	mCamera->setPosition(-400, 50, 900);
	mCamera->lookAt(0,80,0);
}
Banderin::Banderin( Ogre::String nombre , Ogre::SceneManager* sm , float _x , float _y , float _z){

	x = _x;
	y = _y;
	z = _z;
	_sceneManager = sm;

	nodoBanderin = _sceneManager->createSceneNode("Banderin"+nombre);
	Ogre::SceneNode* nodoSuperiorIzq = _sceneManager->createSceneNode(nombre+"superiorIzq");
	Ogre::SceneNode* nodoBandera = _sceneManager->createSceneNode(nombre+"bandera");
	Ogre::SceneNode* nodoSuperiorDer = _sceneManager->createSceneNode(nombre+"superiorDer");
	Ogre::SceneNode* nodoBaseDer = _sceneManager->createSceneNode(nombre+"baseDer");
	
	Ogre::Entity* entBanderin = _sceneManager->createEntity("usb_cilindro.mesh");
	Ogre::Entity* entSuperiorIzq = _sceneManager->createEntity("poly10.mesh");
	Ogre::Entity* entBandera = _sceneManager->createEntity("usb_planocurvo.mesh");
	Ogre::Entity* entSuperiorDer = _sceneManager->createEntity("poly10.mesh");
	Ogre::Entity* entBaseDer = _sceneManager->createEntity("usb_cilindro.mesh");
	
	entBanderin->setMaterialName("banderin");
	entSuperiorIzq->setMaterialName("superior");
	entBandera->setMaterialName("bandera");
	entSuperiorDer->setMaterialName("superior");
	entBaseDer->setMaterialName("banderin");
	
	nodoSuperiorIzq->attachObject(entSuperiorIzq);
	nodoSuperiorIzq->setScale(0.03,0.008,0.06);
	nodoSuperiorIzq->translate(2.2,7.2,0.0);
	nodoSuperiorIzq->rotate(Ogre::Vector3(0.0,0.0,1.0),Ogre::Radian(Ogre::Degree(180.0)));

	nodoBandera->attachObject(entBandera);
	nodoBandera->setScale(1.2,3.85,1.0);
	nodoBandera->translate(-2.2,7.2,0.0);
	nodoBandera->rotate(Ogre::Vector3(0.0,0.0,1.0),Ogre::Radian(Ogre::Degree(90.0)));

	nodoSuperiorDer->attachObject(entSuperiorDer);
	nodoSuperiorDer->setScale(0.03,0.008,0.06);
	nodoSuperiorDer->translate(-152.2,7.2,0.0);

	nodoBaseDer->attachObject(entBaseDer);
	nodoBaseDer->translate(-150.0,0.0,0.0);

	nodoBanderin->attachObject(entBanderin);
	nodoBanderin->addChild(nodoSuperiorIzq);
	nodoBanderin->addChild(nodoBandera);
	nodoBanderin->addChild(nodoSuperiorDer);
	nodoBanderin->addChild(nodoBaseDer);
	
	nodoBanderin->setPosition(x,y,z);
	nodoBanderin->setScale(60.0,600.0,60.0);
}
Ejemplo n.º 6
0
int CUIMain::LoadWorld(void)
{
	Ogre::SceneNode* RootNode = mSceneMgr->getRootSceneNode();

	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -1); //1 unit under the ground
	Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		2000,2000,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
	Ogre::Entity *GroundEnt = mSceneMgr->createEntity("GroundEntity", "ground");
	GroundEnt->setQueryFlags(QUERY_MASK_MOUSE_MOVEMENT);
	GroundEnt->setMaterialName("Rockwall");
	RootNode->createChildSceneNode()->attachObject(GroundEnt);

	CharacterInfo local_player_info;
	mWorld.LocalPlayer = new CLocalPlayer(mWorld, RootNode->createChildSceneNode());
	AttachMeshes(mWorld.LocalPlayer, local_player_info);
	mWorld.LocalPlayer->SetMoveSpeed(100);
	mWorld.LocalPlayer->SetState(State_Idle);

	//Test:
	CreateNewPlayer(0, CharacterInfo());

	Ogre::SceneNode *DestMarkerNode = RootNode->createChildSceneNode();
	Ogre::Entity *DestMarker = mSceneMgr->createEntity("Ent-DestMarker", "arrow.mesh");
	DestMarker->setQueryFlags(0);
	DestMarkerNode->attachObject(DestMarker);
	DestMarkerNode->setVisible(false);
	mWorld.LocalPlayer->SetDestinationMarker(DestMarkerNode, DestMarker);

	mMoveDestinationIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* MouseIndicatorEntity = mSceneMgr->createEntity("Ent-MouseIndicator", "arrow.mesh");
	MouseIndicatorEntity->setQueryFlags(0);
	MouseIndicatorEntity->setMaterialName("ArrowTransparent");
	mMoveDestinationIndicator->attachObject(MouseIndicatorEntity);
	mMoveDestinationIndicator->scale(0.8, 0.8, 0.8);

	mEntityHoveringIndicator = RootNode->createChildSceneNode();
	mEntitySelectionIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* HoverIndicatorEntity = mSceneMgr->createEntity("Ent-HoveringIndicator", "arrows.mesh");
	Ogre::Entity* SelectionIndicatorEntity = mSceneMgr->createEntity("Ent-SelectionIndicator", "arrows.mesh");
	HoverIndicatorEntity->setQueryFlags(0);
	SelectionIndicatorEntity->setQueryFlags(0);
	HoverIndicatorEntity->setMaterialName("ArrowTransparent");
	mEntitySelectionIndicator->setInheritOrientation(false);
	mEntityHoveringIndicator->attachObject(HoverIndicatorEntity);
	mEntitySelectionIndicator->attachObject(SelectionIndicatorEntity);
	mEntityHoveringIndicator->setVisible(false);
	mEntitySelectionIndicator->setVisible(false);

	return 1;
}
Ejemplo n.º 7
0
Ogre::SceneNode* AWGraphics::SceneDirector::createPlane(float x, float y, float z)
{
    Ogre::Plane plane = Ogre::Plane(Ogre::Vector3::UNIT_Y, 0);

    // Initialize a ground entity for later use
    Ogre::MeshManager::getSingleton().createPlane(
        "ground",
        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane,
        1500, 1500, 20, 20,
        true,
        1, 5, 5,
        Ogre::Vector3::UNIT_Z);

    //Ogre::MeshManager::getSingleton().createPlane()

    Ogre::Entity* groundEntity = mSceneMgr->createEntity("ground");
    groundEntity->setMaterialName("Rockwall");
    groundEntity->setCastShadows(false);

    Ogre::SceneNode* ogreNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    ogreNode->attachObject(groundEntity);
    ogreNode->setPosition(x, y, z);
    ogreNode->setOrientation(Ogre::Quaternion::IDENTITY); // hope this is  a good reference

    return ogreNode;
}
Ogre::SceneNode* ParticleFactory::CreateParticleEntity(Ogre::String object_name, Ogre::String material_name,Ogre::SceneNode* parent, Ogre::Vector3 size){

		/* Create one instance of the torus (one entity) */
		/* The same object can have multiple instances or entities */

		/* Create entity */
		Ogre::String name = parent->getName() + object_name;
        //Ogre::Entity* entity = scene_manager->createEntity(object_name);
		Ogre::Entity* entity = scene_manager->createEntity(object_name);

		Ogre::MaterialPtr mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName(material_name));
		//mat = mat->clone(object_name.append("_" +material_name.append("_" + Ogre::StringConverter::toString(materialCounter))));
		mat = mat->clone(name.append("_" +material_name.append("_" + Ogre::StringConverter::toString(materialCounter))));

		//std::cout << "NAME: " << name << std::endl;
		//mat = mat->clone(object_name.append(material_name));
		/* Apply a material to the entity */
		entity->setMaterialName(mat->getName());
		//materialArray[numMaterials] = mat->getName();
		materialArray.push_back(mat->getName());
		

		/* Create a scene node for the entity */
		/* The scene node keeps track of the entity's position */
        Ogre::SceneNode* scene_node = parent->createChildSceneNode(mat->getName());
        scene_node->attachObject(entity);
		//scene_node->translate(0.5,0.5,-1);
		incrementCounter();
		/* Scale the entity */
		scene_node->scale(size);
		return scene_node;
}
Ejemplo n.º 9
0
bool Application::setup()
{
	Ogre::OverlayManager::getSingleton().getByName("InfoPanel")->show();

	m_NXOgreScene->getMaterial(0)->setStaticFriction(0.5);
	m_NXOgreScene->getMaterial(0)->setDynamicFriction(0.5);
	m_NXOgreScene->getMaterial(0)->setRestitution(0.1);

	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 20, 0),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(-1, 30, 0),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 25, 0),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(5, 20, 0),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(-5, 20, 0),"cube.1m.mesh");
	
	m_NXOgreScene->createSceneGeometry(new NxOgre::PlaneGeometry(0, NxOgre::Vec3(0, 1, 0)), Matrix44_Identity);
	
	Ogre::Plane *plane = new Ogre::Plane;
	plane->normal = Ogre::Vector3::UNIT_Y;
	plane->d = 0;

	Ogre::MeshManager::getSingleton().createPlane("ground",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, *plane,
		150, 150, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

	Ogre::Entity* pPlaneEnt = m_sceneMgr->createEntity("groundInstance", "ground");
	pPlaneEnt->setCastShadows(false);
	pPlaneEnt->setMaterialName("Examples/GrassFloor");
	m_sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);
	
	return true;
}
Ejemplo n.º 10
0
void TutorialApplication::crearEscenario(void)
{
	Ogre::Light* luzPrincipal = mSceneMgr->createLight();
	luzPrincipal->setType(Ogre::Light::LT_DIRECTIONAL);
	luzPrincipal->setPosition(Ogre::Vector3(0, 100, 0));
	luzPrincipal->setDirection(Ogre::Vector3(0, -1, 0));
	luzPrincipal->setDiffuseColour(Ogre::ColourValue(1, 1, 1));
	luzPrincipal->setSpecularColour(Ogre::ColourValue(1, 1, 1));

	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
	Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
		plane, 254, 127, 10, 10, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

	Ogre::Entity* groundEntity = mSceneMgr->createEntity("ground");
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
	groundEntity->setCastShadows(false);
	groundEntity->setMaterialName("Custom/TelaBillar");

	PxPhysics* gPhysics = PhysxOgr::PhysxController::getInstance()->getPhysics();
	PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0, 1, 0, 0), *gPhysics->createMaterial(0.5f, 0.5f, 0.6f));
	mPhysx->getScene()->addActor(*groundPlane);
	
	crearBorde(Ogre::Vector3(-132, 0, 0), Ogre::Vector3(0.1, 0.1, 1.27));
	crearBorde(Ogre::Vector3(132, 0, 0), Ogre::Vector3(0.1, 0.1, 1.27));
	crearBorde(Ogre::Vector3(0, 0, 68.5), Ogre::Vector3(2.54, 0.1, 0.1));
	crearBorde(Ogre::Vector3(0, 0, -68.5), Ogre::Vector3(2.54, 0.1, 0.1));
}
Ejemplo n.º 11
0
void WheelAnimalSceneObj::setTableAn(int n, int table)
{

	Ogre::Entity *  ent = getEntity(SceneItemMark(TABLE_0+n));
	if(ent)
		return ent->setMaterialName(_impl->getTableAn(table));
}
Ejemplo n.º 12
0
bool VehicleRenderable::loadEntity(TinyXml::TiXmlElement* ele, Ogre::SceneNode* parent)
{
	Ogre::String name			= getAttrib(ele, "name");
	Ogre::String castShadow		= getAttrib(ele, "castShadows");
	Ogre::String receiveShadow	= getAttrib(ele, "receiveShadows");
	Ogre::String meshFile		= getAttrib(ele, "meshFile");
	Ogre::String materialFile	= getAttrib(ele, "materialFile");

	try
	{
		Ogre::Entity* ent = mSceneMgr->createEntity(name, meshFile);
		mEntities.push_back(ent);

		ent->setCastShadows(Ogre::StringConverter::parseBool(castShadow));

		if (!materialFile.empty())
			ent->setMaterialName(materialFile);

		parent->attachObject(ent);
	}
	catch (...)
	{
		Ogre::LogManager::getSingleton().logMessage("VehicleRenderable Error : parsing <" + name + "> error!");
		return false;
	}

	return true;
}
Ejemplo n.º 13
0
    SceneWidget::SceneWidget(QWidget *parent)
        : QWidget(parent)
        , mWindow(NULL)
        , mCamera(NULL)
        , mSceneMgr(NULL)
    {
        setAttribute(Qt::WA_PaintOnScreen);
        setAttribute(Qt::WA_NoSystemBackground);

        mSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);

        // Throw in a random color just to make sure multiple scenes work
        Ogre::Real r = Ogre::Math::RangeRandom(0, 1);
        Ogre::Real g = Ogre::Math::RangeRandom(0, 1);
        Ogre::Real b = Ogre::Math::RangeRandom(0, 1);
        mSceneMgr->setAmbientLight(Ogre::ColourValue(r,g,b,1));

        Ogre::Light* l = mSceneMgr->createLight();
        l->setType (Ogre::Light::LT_DIRECTIONAL);
        l->setDirection (Ogre::Vector3(-0.4, -0.7, 0.3));
        l->setDiffuseColour (Ogre::ColourValue(0.7,0.7,0.7));

        mCamera = mSceneMgr->createCamera("foo");

        Ogre::Entity* ent = mSceneMgr->createEntity("cube", Ogre::SceneManager::PT_CUBE);
        ent->setMaterialName("BaseWhite");

        mSceneMgr->getRootSceneNode()->attachObject(ent);

        mCamera->setPosition(300,300,300);
        mCamera->lookAt(0,0,0);
        mCamera->setNearClipDistance(0.1);
        mCamera->setFarClipDistance(3000);
    }
Ejemplo n.º 14
0
void OgreApplication::CreateParticleEntity(Ogre::String entity_name, Ogre::String object_name, Ogre::String material_name){

	try {
		/* Create one instance of the torus (one entity) */
		/* The same object can have multiple instances or entities */

		/* Retrieve scene manager and root scene node */
        Ogre::SceneManager* scene_manager = ogre_root_->getSceneManager("MySceneManager");
        Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();

		/* Create entity */
        Ogre::Entity* entity = scene_manager->createEntity(object_name);

		/* Apply a material to the entity */
		entity->setMaterialName(material_name);
		particle_material_name_ = material_name;
		
		/* Create a scene node for the entity */
		/* The scene node keeps track of the entity's position */
        Ogre::SceneNode* scene_node = root_scene_node->createChildSceneNode(entity_name);
        scene_node->attachObject(entity);

		/* Scale the entity */
		scene_node->scale(0.5, 0.5, 0.5);
	}
    catch (Ogre::Exception &e){
        throw(OgreAppException(std::string("Ogre::Exception: ") + std::string(e.what())));
    }
    catch(std::exception &e){
        throw(OgreAppException(std::string("std::Exception: ") + std::string(e.what())));
    }
}
Ejemplo n.º 15
0
	void BaseManager::createDefaultScene()
	{
		mNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
		try
		{
			Ogre::Entity* entity = mSceneManager->createEntity("Mikki.mesh", "Mikki.mesh");			
			mNode->attachObject(entity);
		}
		catch (Ogre::FileNotFoundException&)
		{
			WARNING_LOG( "Can't load Mikki.mesh" )
		}

		try
		{
			Ogre::MeshManager::getSingleton().createPlane(
				"FloorPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
				Ogre::Plane(Ogre::Vector3::UNIT_Y, 0), 1000, 1000, 1, 1, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);

			Ogre::Entity* entity = getSceneManager()->createEntity("FloorPlane", "FloorPlane");
			entity->setMaterialName("Ground");
			mNode->attachObject(entity);
		}
		catch (Ogre::FileNotFoundException&)
		{
			return;
		}
	}
void TutorialApplication::summonEvilBall() {
    Ogre::Entity* ball = mSceneMgr->createEntity("evilBall");
	ball->setMaterialName("Ogre/Skin");

	Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    node->setPosition(Ogre::Vector3(Ogre::Math::SymmetricRandom() * (AREA_RANGE/2),
                                    Ogre::Math::SymmetricRandom() * (AREA_RANGE/2),
                                    Ogre::Math::SymmetricRandom() * (AREA_RANGE/2)));
	node->attachObject(ball);

    ShipProject::GameObject* oBall = new ShipProject::GameObject(ball, 2);
    oBall->SetupCollision(new btSphereShape(BALL_RADIUS), CollisionGroup::BALLS, CollisionGroup::PLAYER | CollisionGroup::WALLS 
                                                   | CollisionGroup::BALLS | CollisionGroup::PROJECTILES_PLAYER);
    objects_.push_back( oBall );

    if (Ogre::Math::UnitRandom() < 0.5) {
        oBall->body()->setLinearVelocity( btVector3(Ogre::Math::SymmetricRandom(), 
                                                    Ogre::Math::SymmetricRandom(), 
                                                    Ogre::Math::SymmetricRandom()) * Ogre::Math::RangeRandom(0.0, 70.0) );
    }
    oBall->body()->setRestitution(1.0);
    oBall->body()->activate(true);
    
    enemies_[oBall->entity_name()] = Enemy(oBall, Ogre::Math::UnitRandom() * 5);
}
Ejemplo n.º 17
0
void createBall(std::string name, dReal x, dReal y, dReal z) {
  Ogre::Entity* e;
  e=sceneMgr_->createEntity(name.c_str(), "sphere.mesh");
  Ogre::SceneNode* n;
  n=sceneMgr_->getRootSceneNode()->createChildSceneNode(name.c_str());

  n->attachObject(e); 
  n->scale(0.03, 0.03, 0.03);
  e->setMaterialName("MyOwn/Sphere");

  dBodyID b;
  dGeomID g;
  dMass m;

  static dContact contact=ballContact();

  g = World::getSingletonPtr()->addSphere(3.0);
  dMassSetSphere (&m,1,3.0);

  b=World::getSingletonPtr()->add(g,&m);
  
  dGeomSetData(g,(void*)&contact);

  names.push_back(name);
  geoms.push_back(g);
  dBodySetPosition (b, x, y, z);
  MyTools::byOdeToOgre(b, n);
}
Ejemplo n.º 18
0
void createBox(std::string name, dReal x, dReal y, dReal z) {
  Ogre::Entity* e;
  e=sceneMgr_->createEntity(name.c_str(), "cube.mesh");
  Ogre::SceneNode* n;
  n=sceneMgr_->getRootSceneNode()->createChildSceneNode(name.c_str());

  n->attachObject(e); 
  n->scale(0.02, 0.02, 0.02);
  e->setMaterialName("Car/Subframe");

  dBodyID b;
  dGeomID g;
  dMass m;

  static dContact contact=boxContact();

  g = World::getSingletonPtr()->addBox(2.0, 2.0, 2.0);
  dMassSetBox (&m, 1 ,2.0, 2.0, 2.0);

  b=World::getSingletonPtr()->add(g,&m);
  
  dGeomSetData(g,(void*)&contact);

  names.push_back(name);//for updating
  geoms.push_back(g);
  dBodySetPosition (b, x, y, z);
  MyTools::byOdeToOgre(b, n);
}
Ejemplo n.º 19
0
	void DemoKeeper::createEntities()
	{
#ifdef MYGUI_OGRE_PLATFORM
		Ogre::Entity* entity = getSceneManager()->createEntity("friend", "Mikki.mesh");
		Ogre::SceneNode* node = getSceneManager()->getRootSceneNode()->createChildSceneNode();
		node->attachObject(entity);
		node->setPosition(0, 0, 300);

		entity = getSceneManager()->createEntity("enemy", "Robot.mesh");
		node = getSceneManager()->getRootSceneNode()->createChildSceneNode();
		node->attachObject(entity);
		node->setPosition(0, 0, -300);
		//node->showBoundingBox(true);

		Ogre::MeshManager::getSingleton().createPlane(
			"FloorPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
			Ogre::Plane(Ogre::Vector3::UNIT_Y, 0), 2000, 2000, 1, 1, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);

		entity = getSceneManager()->createEntity("floor", "FloorPlane");
		entity->setMaterialName("Ground");
		node = getSceneManager()->getRootSceneNode()->createChildSceneNode();
		node->attachObject(entity);

		gRaySceneQuery = getSceneManager()->createRayQuery(Ogre::Ray());
#else
		MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
#endif
	}
Ejemplo n.º 20
0
void QOgreWindow::createScene()
{
    // Put anything in here, I'll just put a plane and a dragon here for testing purposes. Go crazy.

    // Plane
    Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);

    Ogre::MeshManager::getSingleton().createPlane(
                "ground",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                plane,
                1500,1500,20,20,
                true,
                1,5,5,
                Ogre::Vector3::UNIT_Z);

    Ogre::Entity* ground = oSceneMgr->createEntity("ground");
    oSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ground);
    ground->setCastShadows(false);
    ground->setMaterialName("Examples/Rockwall");

    // Dragon Mesh
    oSceneMgr->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
    Ogre::Entity* ogreHead = oSceneMgr->createEntity("Icosphere.mesh");
    Ogre::SceneNode* node = oSceneMgr->getRootSceneNode()->createChildSceneNode();

    node->attachObject(ogreHead);
    node->setPosition(0.0,70.0,0.0);

    Ogre::Light* light = oSceneMgr->createLight("MainLight");
    light->setPosition(20, 80, 50);
}
Ejemplo n.º 21
0
Level::Level(Ogre::SceneManager *a_scenemgr)
: IEvent()
{
	m_castle = new Castle(a_scenemgr);
	// Belysningen, tillfällingt
	m_light1 = new LightSource(a_scenemgr, Ogre::Vector3(-600, 100, -600), "Light1");
	m_light2 = new LightSource(a_scenemgr, Ogre::Vector3(600, 100, 600), "Light2");

	// Skyboxen, tillfällingt
    a_scenemgr->setSkyBox(true, "Ruins");

	// Plane, tillfällingt
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
	Ogre::MeshManager::getSingleton().createPlane("ground",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
	   1500,1500,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
	Ogre::Entity *entGround = a_scenemgr->createEntity("GroundEntity", "ground");
	entGround->setMaterialName("test1");
    entGround->setCastShadows(false);
	a_scenemgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);

	for (int x = 0; x < MAX_ENEMIES-1 ; x++)
	{
		m_enemy[x] = NULL;
	}
	m_enemyId = 0;

	// Bara för att hämta boundingboxen..
	m_enemy[0] = new Enemy( a_scenemgr, m_enemyId);
	collisionTest = new Collision(m_enemy[0]->GetAABB());
	delete m_enemy[0];
	m_enemy[0] = NULL;
}
Ejemplo n.º 22
0
GameEntity* SphereFactory::make(const rapidjson::Value& jsonobj, SpaceObject*spaceobj){

  // Create the sphere
  Ogre::Entity* entity = game_manager->GetSceneManager()->createEntity(jsonobj["name"].GetString(), Ogre::SceneManager::PT_SPHERE);
  entity->setMaterialName(jsonobj["material"].GetString());

  // Create a SceneNode and attach the Entity to it
  Ogre::SceneNode *node = game_manager->GetSceneManager()->getRootSceneNode()->createChildSceneNode(jsonobj["name"].GetString());
  node->attachObject(entity);

  // Set the node's position
  Eigen::Vector3f positionVec=spaceobj->position.cast<float>();
  node->setPosition(Ogre::Vector3( static_cast<Ogre::Real*>(positionVec.data()) ));

  // Set the node's orientation
  Eigen::Vector4f attitudeVec=spaceobj->attitude.coeffs().cast<float>();
  node->setOrientation(Ogre::Quaternion(static_cast<Ogre::Real*>(attitudeVec.data()) ));

  // Scale the sphere
  node->scale( jsonobj["scale"][0u].GetDouble(), jsonobj["scale"][1u].GetDouble(),jsonobj["scale"][2u].GetDouble() );

  GameEntity*game_entity=new GameEntity(spaceobj,entity,node);
  this->game_manager->add_allocated_object(game_entity);

  return game_entity;
}
	//-----------------------------------------------------------------------
	void EntityRenderer::_prepare(ParticleTechnique* technique)
	{
		/** 
			- This renderer is a ´hacky´ solution to display geometry-based particles. It pre-creates a 
			number of SceneNodes (childs of the parent Node to which the ParticleSystem is attached) and 
			Entities and uses these pools to display the particles. There are better solutions, but 
			this one is simple and fast enough, although it has some drawbacks.
			- Future solutions should rather make use of hardware instancing to display a large number of
			geometry-based particles at once.
		*/

		// Use the given technique, although it should be the same as mParentTechnique (must be set already)
		if (!technique || mRendererInitialised)
			return;

		std::stringstream ss; 
		ss << this;
		mEntityName = mMeshName + ss.str();
		mQuota = technique->getVisualParticleQuota();
		Ogre::SceneNode* parentNode = technique->getParentSystem()->getParentSceneNode();
		Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(mMeshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		Ogre::Mesh* meshPointer = mesh.getPointer();
		Vector3 size = meshPointer->getBounds().getSize();
		mBoxWidth = size.x == 0.0f ? 1.0f : size.x;
		mBoxHeight = size.y == 0.0f ? 1.0f : size.y;
		mBoxDepth = size.z == 0.0f ? 1.0f : size.z;

		if (parentNode)
		{
			// Create number of VisualData objects including SceneNodes
			String sceneNodeName;
			for (size_t i = 0; i < mQuota; i++)
			{
				sceneNodeName = "ParticleUniverse" + ss.str() + StringConverter::toString(i);
				EntityRendererVisualData* visualData = 
					PU_NEW_T(EntityRendererVisualData, MEMCATEGORY_SCENE_OBJECTS)(parentNode->createChildSceneNode(sceneNodeName));

				mAllVisualData.push_back(visualData); // Managed by this renderer
				mVisualData.push_back(visualData); // Used to assign to a particle
			}

			// Create number of Entities
			Ogre::Entity* entity = technique->getParentSystem()->getSceneManager()->createEntity(mEntityName, mMeshName); // Base entity
			vector<EntityRendererVisualData*>::const_iterator it;
			vector<EntityRendererVisualData*>::const_iterator itEnd = mAllVisualData.end();
			size_t j;
			for (it = mAllVisualData.begin(), j = 0; it != itEnd; ++it, ++j)
			{
				Ogre::Entity* clonedEntity = entity->clone(mEntityName + StringConverter::toString(j));
				clonedEntity->setMaterialName(technique->getMaterialName());
				clonedEntity->setRenderQueueGroup(mQueueId);
				mEntities.push_back(clonedEntity);
				(*it)->node->attachObject(clonedEntity);
			}
			technique->getParentSystem()->getSceneManager()->destroyEntity(mEntityName);
		}

		_makeNodesVisible(false);
		mRendererInitialised = true;
	}
Ejemplo n.º 24
0
void LagomPlayerBase::AddConstructionCapability(LagomActorFactory* f)
{
	if(!f)
		return;
	if(_actorFactories.find(f) != _actorFactories.end())
		return;
	
	Ogre::SceneManager* manager = _state.GetSceneManager();
	
	Ogre::SceneNode* node = manager->createSceneNode();
	Ogre::Entity*	constructionObject = manager->createEntity(f->Mesh.c_str());

	Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().getByName(getIntFactory().ConstructingMaterial);
	materialPtr->setSelfIllumination(1.0f,1.0f,1.0f);
	constructionObject->setCastShadows(false);
	constructionObject->setRenderQueueGroup(RENDER_QUEUE_SKIES_LATE);
	constructionObject->setMaterialName(getIntFactory().ConstructingMaterial);
	node->attachObject(constructionObject);
	node->setScale( f->MeshScale );

	_actorFactories.insert(FactoryMap::value_type(f,node));

	
	if(	_selectedActorFactory ==_actorFactories.end())
		_selectedActorFactory=_actorFactories.begin();
}
Ejemplo n.º 25
0
/**
 * Create the Scene.
 *
 * Add a ground plane and a robot.
 */
void Robot::Application::createScene()
{
	// Create a plane for the robot to stand on
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);

	// Add the plane into the mesh manager
	Ogre::MeshManager::getSingletonPtr()->createPlane("plane",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

	// Get the ground plane as an entity
	Ogre::Entity* ground = this->mSceneMgr->createEntity("Ground", "plane");

	// Use the rockwall material
	ground->setMaterialName("Examples/Rockwall");

	// Create the scene node to add the plane to
	Ogre::SceneNode* groundSceneNode = this->mSceneMgr->getRootSceneNode()
		->createChildSceneNode("GroundNode", Ogre::Vector3(0, 0, 0));

	// Add the ground to the node
	groundSceneNode->attachObject(ground);


	// Create a scene node for the robot
	Ogre::SceneNode* robotSceneNode = this->mSceneMgr->getRootSceneNode()
		->createChildSceneNode("RobotNode", Ogre::Vector3(0, 5, 0));

	// Create the robot entity
	this->robotEntity = this->mSceneMgr->createEntity("Robot", "robot.mesh");

	// Add the robot to the scene node
	robotSceneNode->attachObject(this->robotEntity);
}
Ejemplo n.º 26
0
bool Application::createBasicScenary()
{
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 0.5, 5),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 1.5, 5),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 2.5, 5),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 3.5, 5),"cube.1m.mesh");
	m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 12.5, 5),"cube.1m.mesh");

	//m_NXOgreRenderSystem->createBody(new NxOgre::Capsule(2, 4),NxOgre::Vec3(0, 25, 5),"cube.1m.mesh");

	NxOgre::PlaneGeometry * planeGeometry = new NxOgre::PlaneGeometry(0, NxOgre::Vec3(0, 1, 0));
	planeGeometry->setGroup(GROUP_COLLIDABLE_NON_PUSHABLE);
	m_NXOgreScene->createSceneGeometry(planeGeometry, Matrix44_Identity);

	Ogre::Plane *plane = new Ogre::Plane;
	plane->normal = Ogre::Vector3::UNIT_Y;
	plane->d = 0;

	Ogre::MeshManager::getSingleton().createPlane("ground",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, *plane,
		150, 150, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

	Ogre::Entity* pPlaneEnt = m_sceneMgr->createEntity("groundInstance", "ground");
	pPlaneEnt->setCastShadows(false);
	pPlaneEnt->setMaterialName("Examples/GrassFloor");
	m_sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);

	return true;
}
Ejemplo n.º 27
0
void DotSceneLoader::processPlane(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::Real distance = getAttribReal(XMLNode, "distance");
	Ogre::Real width = getAttribReal(XMLNode, "width");
	Ogre::Real height = getAttribReal(XMLNode, "height");
	int xSegments = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "xSegments"));
	int ySegments = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "ySegments"));
	int numTexCoordSets = Ogre::StringConverter::parseInt(getAttrib(XMLNode, "numTexCoordSets"));
	Ogre::Real uTile = getAttribReal(XMLNode, "uTile");
	Ogre::Real vTile = getAttribReal(XMLNode, "vTile");
	Ogre::String material = getAttrib(XMLNode, "material");
	bool hasNormals = getAttribBool(XMLNode, "hasNormals");
	Ogre::Vector3 normal = parseVector3(XMLNode->first_node("normal"));
	Ogre::Vector3 up = parseVector3(XMLNode->first_node("upVector"));

	Ogre::Plane plane(normal, distance);
	Ogre::MeshPtr res = Ogre::MeshManager::getSingletonPtr()->createPlane(
		name + "mesh", "General", plane, width, height, xSegments, ySegments, hasNormals,
		numTexCoordSets, uTile, vTile, up);
	Ogre::Entity* ent = mSceneMgr->createEntity(name, name + "mesh");

	ent->setMaterialName(material);

	pParent->attachObject(ent);
}
Ejemplo n.º 28
0
Barrel::Barrel(Ogre::Vector3 position, Ogre::Quaternion orientation,
  const std::string& name, Ogre::SceneNode* sceneNode,
  Ogre::Real speed, Ogre::Radian turnSpeed,
  Ogre::Entity& entityMesh) :
  MovableEntity(position, orientation, name, sceneNode, speed, turnSpeed),
  selected(false),
  node(NULL) {

	animation = NULL;
	loadAnimation();

	for(unsigned int i = 0; i < numModels; ++i) {
		modelNodes.push_back(sceneNode);
		animationState = entityMesh.getAnimationState("Sneak");
		animationState->setEnabled(true);
		animationState->setLoop(true);
		animationSpeeds.push_back(Ogre::Real(1.5f));
		animationStates.push_back(animationState);
	}
	
	std::string selectid = Factory::getID() + "." + name + "/selected";
	Ogre::Entity* pointerMesh = Game::getScene()->createEntity(selectid, "target.mesh");
	pointerMesh->setMaterialName("target");

	node = sceneNode->createChildSceneNode();
    node->attachObject(pointerMesh);
	node->setVisible(selected);
	node->setPosition(position);
}
Ejemplo n.º 29
0
	void DemoKeeper::createDefaultScene()
	{
#ifdef MYGUI_OGRE_PLATFORM
		try
		{
			Ogre::Entity* entity = getSceneManager()->createEntity("Mikki.mesh", "Mikki.mesh");
			mNode = getSceneManager()->getRootSceneNode()->createChildSceneNode();
			mNode->attachObject(entity);
		}
		catch (Ogre::FileNotFoundException&)
		{
			return;
		}

		try
		{
			Ogre::MeshManager::getSingleton().createPlane(
				"FloorPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
				Ogre::Plane(Ogre::Vector3::UNIT_Y, 0), 1000, 1000, 1, 1, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);

			Ogre::Entity* entity = getSceneManager()->createEntity("FloorPlane", "FloorPlane");
			entity->setMaterialName("Ground");
			mNode->attachObject(entity);
		}
		catch (Ogre::FileNotFoundException&)
		{
		}
#endif // MYGUI_OGRE_PLATFORM
	}
Ejemplo n.º 30
0
Powerup::Powerup(PowerupType powerupType, Ogre::Vector3 spawnAt, int poolIndex)
    : mHasBeenCollected(false),
      mPowerupType(powerupType),
      mPoolIndex(poolIndex),
      mUniqueID(GameCore::mPhysicsCore->getUniqueEntityID()),
      mSound(NULL),
      mNode(NULL),
      mBigScreenOverlayElement(NULL),
      mRigidBody(NULL)
{
#ifdef COLLISION_DOMAIN_CLIENT
    mSound = GameCore::mAudioCore->getSoundInstance(powerupType, mUniqueID, NULL);

    mNode = GameCore::mSceneMgr->getRootSceneNode()->createChildSceneNode("PowerupNode" + boost::lexical_cast<std::string>(mUniqueID));
    PhysicsCore::auto_scale_scenenode(mNode);

    Ogre::Entity* entity = GameCore::mSceneMgr->createEntity("PowerupEntity" + boost::lexical_cast<std::string>(mUniqueID) , "crate.mesh");
    entity->setCastShadows(true);
    entity->setMaterialName("crate_uv");

    mNode->attachObject(entity);
    mNode->translate(spawnAt);

    if ( GameCore::mClientGraphics->mBigScreen != NULL )
        mBigScreenOverlayElement = GameCore::mClientGraphics->mBigScreen->createPowerupOverlayElement(spawnAt, mUniqueID);
#endif

    // Add the physics box for both client and server. Make the client's not collide with anyone

    btScalar bodyRestitution = 0.3f;
    btScalar bodyFriction = 1.0f;
    btScalar bodyMass = 40.0f;


    btCollisionShape *shape = GameCore::mPhysicsCore->getCollisionShape( PHYS_SHAPE_POWERUP );
    btVector3 inertia;
    shape->calculateLocalInertia(bodyMass, inertia);

#ifdef COLLISION_DOMAIN_SERVER
    mRigidBody = new btRigidBody( bodyMass, NULL, shape, inertia );
#else
    mRigidBody = new btRigidBody( bodyMass, (btMotionState *)( new BtOgre::RigidBodyState( mNode ) ), shape, inertia );
#endif

    mRigidBody->setRestitution( bodyRestitution );
    mRigidBody->setFriction( bodyFriction );

    // We must set NO CONTACT COLLISIONS to allow cars to drive through the powerups
    mRigidBody->setUserPointer( this );
    mRigidBody->setActivationState( DISABLE_DEACTIVATION );
    //mRigidBody->translate( BtOgre::Convert::toBullet( spawnAt ) );
    mRigidBody->setWorldTransform( btTransform( btQuaternion::btQuaternion().getIdentity(), BtOgre::Convert::toBullet( spawnAt ) ) );

#ifdef COLLISION_DOMAIN_SERVER
    GameCore::mPhysicsCore->addRigidBody( mRigidBody, COL_POWERUP, COL_CAR | COL_POWERUP | COL_ARENA );
#else
    GameCore::mPhysicsCore->addRigidBody( mRigidBody, COL_POWERUP, COL_POWERUP | COL_ARENA );
#endif
}