本文整理汇总了C++中ogre::SceneNode::yaw方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::yaw方法的具体用法?C++ SceneNode::yaw怎么用?C++ SceneNode::yaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::yaw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void OgreCharacterController::update(Ogre::Real elapsedTime, OIS::Keyboard * input)
{
Ogre::SceneNode * node = getMainNode();
OGRE_ANIMATION_STATE state = IDLE;
if(input->isKeyDown(OIS::KC_W)) {
node->translate(node->getOrientation() * Ogre::Vector3(0, 0, elapsedTime*100));
state = RUN;
}
if(input->isKeyDown(OIS::KC_S)) {
node->translate(node->getOrientation() * Ogre::Vector3(0, 0, elapsedTime*-50));
state = RUN;
}
if(input->isKeyDown(OIS::KC_A)) {
node->yaw(Ogre::Radian(2*elapsedTime));
}
if(input->isKeyDown(OIS::KC_D))
node->yaw(Ogre::Radian(-2*elapsedTime));
if(input->isKeyDown(OIS::KC_RETURN)) {
state = DRAWSWORDS;
}
if(input->isKeyDown(OIS::KC_SPACE)) {
state = SLICE;
}
if(input->isKeyDown(OIS::KC_PGUP)) {
//mRigidBody->setLinearVelocity(btVector3(0, 50, 0));
}
animate(elapsedTime, state);
}
示例2: createScene
//---------------------------------------------------------------------------
void TutorialApplication::createScene()
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(.2f, .2f, .2f));
Ogre::Entity* tudorEntity = mSceneMgr->createEntity("tudorhouse.mesh");
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"Node");
node->attachObject(tudorEntity);
Ogre::Light* light = mSceneMgr->createLight("Light1");
light->setType(Ogre::Light::LT_POINT);
light->setPosition(Ogre::Vector3(250, 150, 250));
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue::White);
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"CamNode1", Ogre::Vector3(1200, -370, 0));
node->yaw(Ogre::Degree(90));
mCamNode = node;
node->attachObject(mCamera);
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"CamNode2", Ogre::Vector3(-500, -370, 1000));
node->yaw(Ogre::Degree(-30));
}
示例3: createScene
void GameState::createScene()
{
// --- Objects
m_pNpc01 = new BaseNpc("Blacksmith", m_pSceneMgr, Ogre::Vector3(50.0f, 0.0f, 50.0f));
m_pNpc01->ChangeState(Work::Instance());
//m_pNpc02 = new BaseNpc("Woman", m_pSceneMgr, Ogre::Vector3(-50.0f, 0.0f, -50.0f));
//m_pNpc01->addLocation(Ogre::Vector3(-100.0f,0.0f,-100.0f));
// --- World
// Light
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));
// Objects
// Home
Ogre::Entity* home = m_pSceneMgr->createEntity("Home", "tudorhouse.mesh");
//home->setCastShadows(true);
Ogre::SceneNode* homeNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("HomeNode");
homeNode->attachObject(home);
homeNode->setPosition(Ogre::Vector3(-400.0f,220.0f,-400.0f));
homeNode->setScale(0.4f, 0.4f, 0.4f);
// Work
Ogre::Entity* work = m_pSceneMgr->createEntity("Work", "tudorhouse.mesh");
//work->setCastShadows(true);
Ogre::SceneNode* workNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("WorkNode");
workNode->attachObject(work);
workNode->setPosition(Ogre::Vector3(400.0f,220.0f,400.0f));
workNode->setScale(0.4f, 0.4f, 0.4f);
workNode->yaw(Ogre::Degree(180));
// Tavern
Ogre::Entity* tavern = m_pSceneMgr->createEntity("Tavern", "tudorhouse.mesh");
//tavern->setCastShadows(true);
Ogre::SceneNode* tavernNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("TavernNode");
tavernNode->attachObject(tavern);
tavernNode->setPosition(Ogre::Vector3(-400.0f,220.0f,400.0f));
tavernNode->setScale(0.4f, 0.4f, 0.4f);
tavernNode->yaw(Ogre::Degree(180));
// Ground
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 = m_pSceneMgr->createEntity("GroundEntity", "ground");
m_pSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
entGround->setMaterialName("Examples/Rockwall");
entGround->setCastShadows(false);
}
示例4: OnMouseMove
void COrbitViewView::OnMouseMove(UINT nFlags, CPoint point)
{
Ogre::Vector3 CameraMove(0.0, 0.0, 0.0);
CEngine * Engine = ((COrbitViewApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_Camera == NULL)
return;
if (m_MouseNavigation)
{
if (m_Orbit)
{
Ogre::SceneNode* CameraNode = m_SceneManager->getSceneNode("CameraNode");
CameraMove[1] = m_MousePosition.y - point.y;
m_Camera->moveRelative(CameraMove);
CameraNode->yaw(Ogre::Radian(0.01 * (m_MousePosition.x - point.x)));
}
else
{
CameraMove[0] = -(m_MousePosition.x - point.x);
CameraMove[1] = m_MousePosition.y - point.y;
m_Camera->moveRelative(CameraMove);
}
m_MousePosition = point;
Root->renderOneFrame();
}
CView::OnMouseMove(nFlags, point);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:33,代码来源:OrbitViewView.cpp
示例5: createScene
//-------------------------------------------------------------------------------------
void TutorialApplication::createScene(void)
{
// create your scene here :)
// Set the scene's ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));
Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
headNode->attachObject(ogreHead);
headNode->yaw( Ogre::Degree( -90 ) );
Ogre::Entity* ogreHead2 = mSceneMgr->createEntity( "Head2", "ogrehead.mesh" );
Ogre::SceneNode* headNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "HeadNode2", Ogre::Vector3( 100, 0, 0 ) );
headNode2->attachObject( ogreHead2 );
headNode2->pitch( Ogre::Degree( -90 ) );
Ogre::Entity* ogreHead3 = mSceneMgr->createEntity( "Head3", "ogrehead.mesh" );
Ogre::SceneNode* headNode3 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "HeadNode3", Ogre::Vector3( 200, 0, 0 ) );
headNode3->attachObject( ogreHead3 );
headNode3->roll( Ogre::Degree( -90 ) );
// Create a Light and set its position
Ogre::Light* light = mSceneMgr->createLight("MainLight");
light->setPosition(20.0f, 80.0f, 50.0f);
}
示例6: 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));
}
示例7: createScene
//-------------------------------------------------------------------------------------
void TutorialApplication::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.25, 0.25, 0.25));
// add the ninja
Ogre::Entity *ent = mSceneMgr->createEntity("Ninja", "ninja.mesh");
Ogre::SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("NinjaNode");
node->attachObject(ent);
// create the light
Ogre::Light *light = mSceneMgr->createLight("Light1");
light->setType(Ogre::Light::LT_POINT);
light->setPosition(Ogre::Vector3(250, 150, 250));
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue::White);
// Create the scene node
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode1", Ogre::Vector3(-400, 200, 400));
// Make it look towards the ninja
node->yaw(Ogre::Degree(-45));
// Create the pitch node
node = node->createChildSceneNode("PitchNode1");
node->attachObject(mCamera);
// create the second camera node/pitch node
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("CamNode2", Ogre::Vector3(0, 200, 400));
node = node->createChildSceneNode("PitchNode2");
}
示例8:
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));
}
示例9: testModelMountScaling
void ModelMountTestCase::testModelMountScaling()
{
Ogre::Root root;
Ogre::SceneManager* sceneManager = root.createSceneManager(Ogre::ST_GENERIC);
TestModel model(*sceneManager);
//First test with a straight forward case.
Ogre::SceneNode* node = sceneManager->getRootSceneNode()->createChildSceneNode();
//We get an error when it's destroyed. So we don't destroy it.
SceneNodeProvider* nodeProvider = new SceneNodeProvider(node, nullptr);
Model::ModelMount mount(model, nodeProvider);
scaleAndTestMount(model, mount, nodeProvider->getNode());
//Test with the parent node being scaled
node->setScale(Ogre::Vector3(3.0f, 0.2f, 200.0f));
Ogre::SceneNode* subNode = node->createChildSceneNode();
nodeProvider = new SceneNodeProvider(subNode, nullptr);
Model::ModelMount mount2(model, nodeProvider);
scaleAndTestMount(model, mount2, nodeProvider->getNode());
//Test with the parent node being scaled and rotated
node->setScale(Ogre::Vector3(3.0f, 0.2f, 200.0f));
node->yaw(Ogre::Degree(42));
node->pitch(Ogre::Degree(76));
node->roll(Ogre::Degree(98));
subNode = node->createChildSceneNode();
nodeProvider = new SceneNodeProvider(subNode, nullptr);
Model::ModelMount mount3(model, nodeProvider);
scaleAndTestMount(model, mount3, nodeProvider->getNode());
}
示例10: createScene
void Hundir::createScene() {
Ogre::Entity* inicio = _sceneManager->createEntity("Inicio.mesh");
Ogre::SceneNode* ninicio = _sceneManager->createSceneNode("ninicio");
_sceneManager->getRootSceneNode()->addChild(ninicio);
ninicio->attachObject(inicio);
ninicio->yaw(Ogre::Degree(-15));
ninicio->pitch(Ogre::Degree(50));
ninicio->roll(Ogre::Degree(90));
ninicio->setScale(1,1.5,1.2);
ninicio->setPosition(0,0,-2);
/* Sombras */
_sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_MODULATIVE);
_sceneManager->setShadowColour(Ogre::ColourValue(0.5, 0.5, 0.5) );
_sceneManager->setAmbientLight(Ogre::ColourValue(0.9, 0.9, 0.9));
_sceneManager->setShadowTextureCount(2);
_sceneManager->setShadowTextureSize(512);
/* Iluminacion */
Ogre::Light *light = _sceneManager->createLight("Light");
light->setType(Ogre::Light::LT_SPOTLIGHT);
light->setDirection(Ogre::Vector3(0,-1,0));
light->setSpotlightInnerAngle(Ogre::Degree(25.0f));
light->setSpotlightOuterAngle(Ogre::Degree(200.0f));
light->setPosition(0, 150, 0);
light->setSpecularColour(1, 1, 1);
light->setDiffuseColour(1, 1, 1);
light->setSpotlightFalloff(5.0f);
light->setCastShadows(true);
}
示例11: frameStarted
bool frameStarted(const Ogre::FrameEvent &evt)
{
if (Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()->isClosed())
{
return false;
}
m_renderNode->yaw(Ogre::Radian(evt.timeSinceLastFrame)*Ogre::Math::PI*2.*(1./10.)); // one turn in 10sec
CefDoMessageLoopWork();
return true;
}
示例12: spawn_enemy
void MainApplication::spawn_enemy()
{
// if(enemyCounter < MAX_ENEMY)
//{
Ogre::String number = Ogre::StringConverter::toString(enemyCounter + 1);
enemies.push_back("HeadNode" + number);
Ogre::Entity* ogreHead = mSceneMgr->createEntity("ogrehead.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode" + number);
Ogre::Vector3 pos1(mSceneMgr-> getSceneNode("NinjaNode")->getPosition());
headNode -> setPosition(Ogre::Vector3(1000, rand() % 800 - 400, pos1.z));
headNode -> attachObject(ogreHead);
headNode->yaw(Ogre::Degree(-90));
enemyCounter++;
// }
}
示例13: doEnable
///重载,被用于进入消息管理调用
void SanZhugeActor::doEnable(void)
{
_zhuge = ComponentFactories::getInstance().create("SanZhuGe");
COgreEntityInterface * entity = _zhuge->queryInterface<COgreEntityInterface>();
Ogre::SceneNode *sn = entity->getSceneNode();
sn->setPosition(_pos);
sn->setScale(_scale);
sn->yaw(Ogre::Radian(_radian));
_process
->queryInterface<CSanProcessInterface>()
->addObject(_zhuge);
setChannel(Orz::EventChannel::create().clear());
}
示例14: destination
//-------------------------------------------------------------------------------------
bool
PlayersManager::moving(zappy::Player *p, int i)
{
OPlayer *OPlayer = this->mOPlayers.at(i);
this->speed = Constants::SquareSize /
((Constants::timeUnit / static_cast<Ogre::Real>(time)));
Ogre::SceneNode *node = OPlayer->getSceneNode();
Ogre::Vector3 &direction = OPlayer->getDirection();
Ogre::Real &distance = OPlayer->getDistance();
Ogre::Real move = this->speed * this->tslf;
Ogre::Vector3 destination(p->getX() * Constants::SquareSize, 0, p->getY() * Constants::SquareSize);
Ogre::AnimationState *anim = OPlayer->getEntity()->
getAnimationState(distance <= 0.0f ? "Idle" : "Walk");
anim->setLoop(true);
anim->setEnabled(true);
if (direction == Ogre::Vector3::ZERO)
{
Ogre::Vector3 src = node->getOrientation() * Ogre::Vector3::UNIT_X;
direction = destination - node->getPosition();
distance = direction.normalise();
if ((1.0f + src.dotProduct(direction)) < 0.0001f)
node->yaw(Ogre::Degree(180));
else
node->rotate(src.getRotationTo(direction));
if (distance > Constants::SquareSize)
distance = 0.0f;
}
else
{
distance -= move;
if (distance <= 0.0f)
{
node->setPosition(destination);
direction = Ogre::Vector3::ZERO;
}
else
node->translate(direction * move);
}
if (OPlayer->stateHasChanged())
OPlayer->detachAnim();
anim->addTime(this->tslf);
return true;
}
示例15: createWall
Wall* Application::createWall(Ogre::String nme, GameObject::objectType tp, Ogre::String meshName, int x, int y, int z, Ogre::Vector3 scale, Ogre::Degree pitch, Ogre::Degree yaw, Ogre::Degree roll, Ogre::SceneManager* scnMgr, GameManager* ssm, Ogre::Real mss, Ogre::Real rest, Ogre::Real frict, bool kinematic, Simulator* mySim) {
createRootEntity(nme, meshName, x, y, z);
Ogre::SceneNode* sn = mSceneManager->getSceneNode(nme);
Ogre::Entity* ent = SceneHelper::getEntity(mSceneManager, nme, 0);
const btTransform pos;
OgreMotionState* ms = new OgreMotionState(pos, sn);
sn->setScale(scale.x, scale.y, scale.z);
sn->pitch(pitch);
sn->yaw(yaw);
sn->roll(roll);
Wall* obj = new Wall(nme, tp, mSceneManager, ssm, sn, ent, ms, mySim, mss, rest, frict, scale, kinematic);
obj->addToSimulator();
return obj;
}