コード例 #1
0
	//-----------------------------------------------------------------------
	void ParticleSystem::_process(ParticleTechnique* technique, Real timeElapsed)
	{
		// Inherited from the Particle class and is only called if the Particle System is emitted.
		// Update node position.
		Particle::_process(technique, timeElapsed);
		Ogre::Node* node = technique->getParentSystem()->getParentNode();
		if (mParentNode && node)
		{
			// position attribute is derived, but the the parentNode position must be set in relation to its parent.
			mParentNode->setPosition(position - node->getPosition());
		}
	}
コード例 #2
0
void InputListener::updateGravity(const Ogre::FrameEvent& evt)
{
  for (std::list<PhysBody>::iterator it = this->_PhysicList->begin(); it != this->_PhysicList->end(); it++)
  {
    Ogre::Node *node = this->_SceneMgr->getRootSceneNode()->getChild(it->getName());
    Worms *worm;
    worm = this->_Game->findWormByName(it->getName());

    if (!this->_CollisionMgr->isCollidedToStatic(it->getName(), CollisionManager::DOWN) && node->getPosition().y > 0 && !this->_Game->getTeleportActivated())
      {
        if (!this->_CollisionMgr->isCollidedToStatic(it->getName(), CollisionManager::DOWN))
          node->translate(0, -1 * it->getWeight() * evt.timeSinceLastFrame, 0);
        worm->fall(1);
      }
    else
      worm->fall(0);
  }
}