当前位置: 首页>>代码示例>>C++>>正文


C++ SceneNode::scale方法代码示例

本文整理汇总了C++中ogre::SceneNode::scale方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::scale方法的具体用法?C++ SceneNode::scale怎么用?C++ SceneNode::scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::SceneNode的用法示例。


在下文中一共展示了SceneNode::scale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void DrivingSimulatorV1::createScene1() // city
{
	// create world node
	Ogre::SceneNode* worldNode = sceneManager->getRootSceneNode()->createChildSceneNode();
	Ogre::Entity* cityWorld = sceneManager->createEntity("CityWorld.mesh");
	worldNode->scale(0.05, 0.05, 0.05);
	worldNode->attachObject(cityWorld);

	// create ETH Node
	Ogre::SceneNode* ethNode = sceneManager->getRootSceneNode()->createChildSceneNode();
	Ogre::Entity* eth = sceneManager->createEntity("ETH.mesh");
	ethNode->attachObject(eth);
	ethNode->scale(1.3, 1.3, 1.3);
	ethNode->setPosition(428, 0, 235);
	ethNode->yaw(Ogre::Degree(210));

	// create ambient light
	sceneManager->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));

	// create sun light
	Ogre::Light* sunLight = sceneManager->createLight();
	sunLight->setType(Ogre::Light::LT_DIRECTIONAL);
	sunLight->setDirection(Ogre::Vector3(-0.5, -0.5, 0.5));
	sunLight->setDiffuseColour(Ogre::ColourValue(1, 1, 1));
	sunLight->setSpecularColour(Ogre::ColourValue(0.7, 0.7, 0.7));

	// set car to initial position and orientation
	carNode->setPosition(584, 0, 121);
	carNode->setOrientation(Ogre::Quaternion(Ogre::Degree(-4.5), Ogre::Vector3::UNIT_Y));
}
开发者ID:pa2011,项目名称:PA2011,代码行数:30,代码来源:DrivingSimulatorV1.cpp

示例2: createProjectile

void ProjectileManager::createProjectile(const Ogre::Vector3& tankPosition, const Ogre::Quaternion& turretOrientation, 
										 const Ogre::Degree& angle, const float& velocity, const float& dmg){
	
	std::ostringstream oss;
	oss << "Projectile" << time(0) << projectiles.size() << counter++;										 
											 
	Ogre::ParticleSystem* particleSystem = mSceneMgr->createParticleSystem(oss.str(), "Examples/PurpleFountain");

	scaleBy(1.f, particleSystem);

	Ogre::SceneNode* parentParticleSn = mSceneMgr->getRootSceneNode()->createChildSceneNode();

	Ogre::SceneNode* particleSn = parentParticleSn->createChildSceneNode();

	Ogre::Vector3 start(-115.f, 10.f, 0.f);

	parentParticleSn->setPosition(tankPosition);
	particleSn->setPosition(start);

	parentParticleSn->yaw(turretOrientation.getYaw());

	particleSn->attachObject(particleSystem);

	particleSn->roll(Ogre::Degree(-90.f));

	particleSn->scale(Ogre::Vector3(0.1f));

	projectiles.insert(new Projectile(start, particleSn, angle, velocity, dmg));
}
开发者ID:swn881,项目名称:CSCI356_JUSTDOEET,代码行数:29,代码来源:ProjectileManager.cpp

示例3: createBox

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);
}
开发者ID:antoineB,项目名称:vroom,代码行数:28,代码来源:demo.cpp

示例4:

Shuriken::Shuriken(Ogre::SceneManager* mSceneMgr, Ogre::SceneNode* parentNode, PhysicsEngine* bulletEngine, const Ogre::Vector3& pos, bool isTennis) :  
	graphicsEngine(mSceneMgr),
	positionNode(0),
	active(true),
	physicsEngine(bulletEngine),
	colliding(false),
	shooting(false)
{
	Ogre::Real ratio = SIZE_REGULAR_SHURIKEN;
	
	if(isTennis){
		entShuriken = mSceneMgr->createEntity(Ogre::SceneManager::PT_SPHERE);
		entShuriken->setMaterialName("Examples/TennisBall");
		ratio = ratio/100;
	} else
		entShuriken = mSceneMgr->createEntity("Shuriken.mesh");
	entShuriken->setCastShadows(true);

	positionNode = parentNode->createChildSceneNode(pos);
	Ogre::SceneNode* tempNode = positionNode->createChildSceneNode();
	tempNode->attachObject(entShuriken);
	tempNode->scale(ratio, ratio, ratio);
	
	physicsObject.setToSphere(
		SIZE_REGULAR_SHURIKEN, 
		2, 
		btQuaternion(0.2f, 0.6f, 0.1f, 1.0f).normalized(),
		btVector3(pos.x,pos.y,pos.z) 
	);
	physicsObject.setRestitution(0.99);
	physicsObject.setLinearVelocity(btVector3(0,0,0));
	physicsObject.setFriction(0.5);  
	physicsObject.setAngularVelocity(btVector3(0.2f, 0.5f, 0.2f));
	physicsEngine->addObject(&physicsObject);
}
开发者ID:chooper9,项目名称:cs354r-assignment4,代码行数:35,代码来源:Shuriken.cpp

示例5: createBall

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);
}
开发者ID:antoineB,项目名称:vroom,代码行数:28,代码来源:demo.cpp

示例6: make

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;
}
开发者ID:jhaiduce,项目名称:openspacesim,代码行数:26,代码来源:GameManager.cpp

示例7: DrawNewCore

void TestGame::DrawNewCore(Logic::CoreBuiltEvnt *evnt){

	Ogre::Entity* drop= mSceneMgr->createEntity("Mesh"+evnt->building->mSysName, "BaseDropNew.mesh");
	drop->setCastShadows(true);
	const Ogre::AxisAlignedBox test =drop->getBoundingBox();
	Control::ClickHelper* helpr = 	new Control::ClickHelper(Logic::CHT_BUILDING);
	helpr->target = evnt->building;
	drop->setUserAny(Ogre::Any(helpr));
	Ogre::SceneNode *coreNode = evnt->country->mNode->createChildSceneNode();
	Ogre::Vector3 tempvect = calculateActualPointFromCenter(evnt->country->mCapital.mPosition,evnt->tile->mPosition);
	tempvect= tempvect*TILESIZE;
	coreNode->attachObject(drop);
	coreNode->translate(tempvect);
	coreNode->pitch(Ogre::Degree(90));
	coreNode->scale(0.5,0.5,0.5);
	Ogre::AnimationState* temp= drop->getAnimationState("drop");
	temp->setLoop(false);
	temp->setEnabled(true);
	mAllAnimation .insert(temp);
	Ogre::Entity* basePlane= mSceneMgr->createEntity("MeshBaseFloor"+evnt->building->mSysName, "BaseCloseLook.mesh");
	basePlane->setMaterialName("BaseCloseLook/Rockwall");

	Ogre::SceneNode *BaseDraw = evnt->country->mNode->createChildSceneNode(),*camspot;
	BaseDraw->attachObject(basePlane);
	BaseDraw->translate(2000*evnt->building->mSlot,0,0);
	camspot = BaseDraw->createChildSceneNode("CamPoint_"+evnt->building->mSysName);
	camspot->setPosition(0,45,45);
	camspot->lookAt(Ogre::Vector3(0,0,0), Ogre::Node::TS_PARENT);
	helpr = 	new Control::ClickHelper(Logic::CHT_EMPTYSPACE);
	helpr->target = evnt->building;
	basePlane->setUserAny(Ogre::Any(helpr));
}
开发者ID:JazzyJohn,项目名称:ProtoSpaceGame,代码行数:32,代码来源:AllRenderFunction.cpp

示例8: createScene

//-------------------------------------------------------------------------------------
void DeltaControl::createScene(void) {

    mSceneMgr->setSkyBox(true, "StormySkyBox");

    mControlCenter = new ControlCenter(mSceneMgr);

    /* *********************************************************
     * ENTITIES
     * *********************************************************/

//	Telephone* phone = new Telephone(mSceneMgr, "phone1");
//	phone->init();

    // Create entity from mesh and attach it to a scene node.
    Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    Ogre::Entity* ent = mSceneMgr->createEntity("Sinbad", "Sinbad.mesh");
    node->attachObject(ent);
    node->setPosition(0,50,0);
    node->scale(10,10,10);

    // Set animation blend mode to additive / cumulative.
    ent->getSkeleton()->setBlendMode(Ogre::ANIMBLEND_CUMULATIVE);

    // Get the two halves of the idle animation
    Ogre::AnimationState* baseAnim = ent->getAnimationState("IdleBase");
    Ogre::AnimationState* topAnim = ent->getAnimationState("IdleTop");

    // Enable both of them and set them to loop.
    baseAnim->setLoop(true);
    topAnim->setLoop(true);
    baseAnim->setEnabled(true);
    topAnim->setEnabled(true);

}
开发者ID:fdomig,项目名称:DeltaControl,代码行数:35,代码来源:DeltaControl.cpp

示例9: mass

/* ----------------------------------------------------------------------- 
 | build bullet box shape
 | 
 | : default create 125 (5x5x5) dynamic object
   ----------------------------------------------------------------------- */
bool
buildBoxShapeArray(Ogre::SceneManager* sceneMgr, btDynamicsWorld* dynamicsWorld, btAlignedObjectArray<btCollisionShape*>& collisionShapes,
                   const btVector3& array_size, btScalar scale)
{
    btTransform startTransform;
    startTransform.setIdentity();

    btScalar mass(1.f);	
    btVector3 localInertia(0,0,0);	
    btBoxShape* colShape = new btBoxShape(btVector3(scale, scale, scale));
    btAssert(colShape);    
    colShape->calculateLocalInertia(mass,localInertia);
    collisionShapes.push_back(colShape);

    float start_x = - array_size.getX()/2;
    float start_y = array_size.getY();
    float start_z = - array_size.getZ()/2;

    int index = 0;
    for (int k=0;k<array_size.getY();k++)
    {
	    for (int i=0;i<array_size.getX();i++)
	    {
            for(int j=0;j<array_size.getZ();j++)
		    {
			    startTransform.setOrigin(scale * btVector3(
								    btScalar(2.0*i + start_x),
								    btScalar(20+2.0*k + start_y),
								    btScalar(2.0*j + start_z)));

			    //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
			    btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
			    btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);
			    btRigidBody* body = new btRigidBody(rbInfo);
                body->setContactProcessingThreshold(BT_LARGE_FLOAT);

                if (sceneMgr)
                {
                    Ogre::Entity* ent = sceneMgr->createEntity("ent_" + Ogre::StringConverter::toString(index++),"Barrel.mesh");

                    Ogre::SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("node_box_" + Ogre::StringConverter::toString(index++));
                    node->attachObject(ent);
                    node->setPosition(startTransform.getOrigin().getX(), startTransform.getOrigin().getY(), startTransform.getOrigin().getZ());

                    const Ogre::AxisAlignedBox& aabb = ent->getBoundingBox();
                    const Ogre::Vector3& boxScale = (aabb.getMaximum() - aabb.getMinimum())/2.0f;
                    node->scale(scale/boxScale.x, scale/boxScale.y, scale/boxScale.z);

                    body->setUserPointer((void*)node);
                }

			    dynamicsWorld->addRigidBody(body);
		    }
	    }		
    }

    return true;
}
开发者ID:valkidy,项目名称:OgreSimpleApplication,代码行数:63,代码来源:CSamplePhysicUtility.cpp

示例10: createGrassMesh

bool 
CGrassSticks::buildGrassSticks(Ogre::SceneManager* sceneMgr, btDynamicsWorld* dynamicsWorld, btSoftBodyWorldInfo &softBodyWorldInfo)
{    
    // create our grass mesh, and create a grass entity from it
    if (!sceneMgr->hasEntity(GRASS_MESH_NAME))
    {
	    createGrassMesh();
    } // End if

    const int		n=16;
	const int		sg=4;    
	const btScalar	sz=16;
	const btScalar	hg=4;
	const btScalar	in=1/(btScalar)(n-1);
    int             index = 0;

	for(int y=0;y<n;++y)
	{
		for(int x=0;x<n;++x)
		{
			const btVector3	org(-sz+sz*2*x*in,
				1,
				-sz+sz*2*y*in);
			btSoftBody*		psb=btSoftBodyHelpers::CreateRope(softBodyWorldInfo, org,
				org+btVector3(hg*0.001f,hg,0),
				sg,
				1);
			psb->m_cfg.kDP		=	0.005f;
			psb->m_cfg.kCHR		=	0.1f;
			for(int i=0;i<3;++i)
			{
				psb->generateBendingConstraints(2+i);
			}
			psb->setMass(1,0);
			psb->setTotalMass(0.01f);
                       
            static_cast<btSoftRigidDynamicsWorld*>(dynamicsWorld)->addSoftBody(psb);
            
            const Ogre::String& strIndex = Ogre::StringConverter::toString(index++);
            Ogre::Entity* grass = sceneMgr->createEntity("Grass" + strIndex, GRASS_MESH_NAME);
            Ogre::SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("node_grass_" + strIndex
                ,Ogre::Vector3(org.getX(), org.getY(), org.getZ())
                ,Ogre::Quaternion(Ogre::Degree(0), Vector3::UNIT_Y));
            node->attachObject(grass);
            node->scale(1.0f, Ogre::Math::RangeRandom(0.85f, 1.15f), 1.0f);
            node->setVisible(true);
                                    
            psb->setUserPointer((void*)(grass->getSubEntity(0)));
		} // End for
	} // End for

    dynamicsWorld->setInternalTickCallback(&CGrassSticks::simulationTickCallback);
    
    return true;
}
开发者ID:valkidy,项目名称:OgreSimpleApplication,代码行数:55,代码来源:CSampleGrassSticks.cpp

示例11: crearBorde

void TutorialApplication::crearBorde(Ogre::Vector3 posicion, Ogre::Vector3 escala)
{
	Ogre::Entity *borde = mSceneMgr->createEntity("cube.mesh");
	borde->setMaterialName("Custom/TelaBillar");
	borde->setCastShadows(false);

	Ogre::SceneNode *nodoBorde = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	nodoBorde->setPosition(posicion);
	nodoBorde->attachObject(borde);
	nodoBorde->scale(escala);
}
开发者ID:aferrandoa,项目名称:MasterIARFID,代码行数:11,代码来源:TutorialApplication.cpp

示例12: createScene

//--------------------------------------------------------------------------------------
void LapTrainer::createScene(void)
{
		//Create right stick
		Ogre::Entity* StickRight = mSceneMgr->createEntity("StickRight", "instrument_stick.mesh");
		StickRight -> setCastShadows(true);
		Ogre::SceneNode* RightNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("RightNode", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
		//RightNode->setPosition(Ogre::Vector3(300, 100, 100));
		RightNode->setPosition(Ogre::Vector3(300, 500, 500));//alex
		RightNode->setOrientation(0.383022, -0.383022, 0.821394, -0.178606);//alex
		RightNode->scale( 1, 1, 1); 
		Ogre::SceneNode* child = RightNode->createChildSceneNode("MoveNodeRight");
		child->attachObject(StickRight);
		child->translate(0,0,0);


		//Create left stick
		Ogre::Entity* entPenguin2 = mSceneMgr->createEntity("StickLeft", "instrument_stick.mesh");
		entPenguin2 -> setCastShadows(true);
		Ogre::SceneNode* nodPenguin2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("LeftNode", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
		//nodPenguin2->setPosition(Ogre::Vector3(-300, 100, 100));
		nodPenguin2->setPosition(Ogre::Vector3(-300, 500, 500));//alex
		//nodPenguin2->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);//alex //this stick is not working
		nodPenguin2->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);//alex //this stick is not working
		nodPenguin2->scale( 1, 1, 1); 
		Ogre::SceneNode* child2 = nodPenguin2->createChildSceneNode("MoveNodeLeft");
		child2->attachObject(entPenguin2);
		child2->translate(0,0,0);

		Ogre::Entity* Element1 = mSceneMgr->createEntity("Element1", "exercise1.mesh");//Place your mesh here
		Element1 -> setCastShadows(true);
		Ogre::SceneNode* Element1Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element1Node", Ogre::Vector3(0, -200, 200));//X-Y-Z
		Element1Node->scale( 400, 400, 400); 
		Element1Node->attachObject(Element1);

		Ogre::Entity* Element2 = mSceneMgr->createEntity("Element2", "Sphere002.mesh");//Place your mesh here
		Element2 -> setCastShadows(true);
		//Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0, 50, 100));//X-Y-Z
		Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
		Element2Node->setPosition(Ogre::Vector3(300, 500, 500));
		Element2Node->setOrientation(0.383022, -0.383022, 0.821394, -0.178606);
		Element2Node->scale( 60, 60, 60); 
		Element2Node->attachObject(Element2);

		Ogre::Entity* Element3 = mSceneMgr->createEntity("Element3", "Sphere002.mesh");//Place your mesh here
		Element3 -> setCastShadows(true);
		//Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0, 50, 100));//X-Y-Z
		Ogre::SceneNode* Element3Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element3Node", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
		Element3Node->setPosition(Ogre::Vector3(-300, 500, 500));
		Element3Node->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);
		Element3Node->scale( 60, 60, 60); 
		Element3Node->attachObject(Element3);


}
开发者ID:sw-eng-2014,项目名称:general_solution,代码行数:55,代码来源:LapTrainer.cpp

示例13: scaleMesh

void ExteriorCellRender::scaleMesh(Ogre::Vector3 axis,  std::string sceneNodeName[], int elements)
{
    assert(mInsert);
    Ogre::SceneNode *parent = mInsert;
     //std::cout << "ELEMENTS:" << elements;
    for (int i = 0; i < elements; i++){
       if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
           parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
    }
       parent->scale(axis);
}
开发者ID:akebono,项目名称:openmw,代码行数:11,代码来源:exterior.cpp

示例14: addMiniMapEntity

Ogre::SceneNode* MiniMapManager::addMiniMapEntity(Ogre::Vector3 *pos, const std::string &meshName)
{
	Ogre::Entity *entity = mSceneMgr->createEntity(meshName);
	Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();

	Ogre::Vector3 convertedPos = Ogre::Vector3(pos->z/ZoomRatio, -pos->x/ZoomRatio, 0);
	node->setPosition(convertedPos);
	node->attachObject(entity);
	node->scale(Scale, Scale, Scale);
	return node;
}
开发者ID:aisle2678,项目名称:TankFight,代码行数:11,代码来源:MiniMapManager.cpp

示例15: create

int Create_Static_Object::create(Ogre::SceneManager *mainSceneMgr) {
    if (meshName.empty() ) {
        std::cout << "Whoops, what do you think you're doing? You didn't give a mesh name!" << std::endl;
        return 0;
    }

    if (meshFile.empty() ) {
        std::cout << "Well what did you expect? There's no mesh file to load!" << std::endl;
        return 0;
    }

    Ogre::SceneNode *nodeStaticObject = mainSceneMgr->getRootSceneNode()->createChildSceneNode(meshName, location, rotation);
    Ogre::Entity *entityStaticObject = mainSceneMgr->createEntity(meshName, meshFile);

    if (!materialName.empty() ){
        entityStaticObject->setMaterialName(materialName);
    }

    entityStaticObject->setCastShadows(shadow);

    nodeStaticObject->attachObject(entityStaticObject);
    nodeStaticObject->showBoundingBox(showBBox);
    nodeStaticObject->scale(scale);

    //Create the ground shape.
    BtOgre::StaticMeshToShapeConverter ogreBulletShapeConverter(entityStaticObject);
    if (bulletCollision == "sphere"){
        shapeStaticObject = ogreBulletShapeConverter.createSphere();
    } else if (bulletCollision == "box"){
        shapeStaticObject = ogreBulletShapeConverter.createBox();
        offsetLocation = entityStaticObject->getBoundingBox().getHalfSize();
        location.y = location.y - offsetLocation.y;
    } else if (bulletCollision == "trimesh"){
        shapeStaticObject = ogreBulletShapeConverter.createTrimesh();
    } else if (bulletCollision == "cylinder"){
        shapeStaticObject = ogreBulletShapeConverter.createCylinder();
    } else if (bulletCollision == "convex"){
        shapeStaticObject = ogreBulletShapeConverter.createConvex();
    }else{
        return 0;
    }

    shapeStaticObject->setLocalScaling(BtOgre::Convert::toBullet(nodeStaticObject->getScale() ) );

    //Create MotionState (no need for BtOgre here, you can use it if you want to though).
    stateStaticObject = new btDefaultMotionState(btTransform( BtOgre::Convert::toBullet(rotation),  BtOgre::Convert::toBullet(location) ) );

    //Create the Body.
    bodyStaticObject = new btRigidBody(0, stateStaticObject, shapeStaticObject, btVector3(0,0,0));
    Globals::phyWorld->addRigidBody(bodyStaticObject);

    return 1;
}
开发者ID:ramyD,项目名称:Fourth,代码行数:53,代码来源:PlayState.cpp


注:本文中的ogre::SceneNode::scale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。