void SimpleEntityVisualization::updatePositionAndOrientation() { if (mEntity.getPredictedPos().isValid()) { mSceneNode->setPosition(Convert::toOgre(mEntity.getPredictedPos())); mVelocitySceneNode->setPosition(Convert::toOgre(mEntity.getPredictedPos())); } if (mEntity.getOrientation().isValid()) { mSceneNode->setOrientation(Convert::toOgre(mEntity.getOrientation())); } if (mEntity.getVelocity().isValid() && mEntity.getVelocity() != WFMath::Vector<3>::ZERO()) { mVelocitySceneNode->setVisible(true); WFMath::Quaternion q; q.identity(); q.rotation(WFMath::Vector<3>(-1, 0, 0), mEntity.getVelocity(), WFMath::Vector<3>(0, 0, 1)); if (q.isValid()) { mVelocitySceneNode->setOrientation(Convert::toOgre(q)); } else { mVelocitySceneNode->setVisible(false); } } else { mVelocitySceneNode->setVisible(false); } }
void Renderer::drawEntity(Eris::Entity * ent, RenderableEntity * pe, const PosType & cp) { assert(ent != 0); PosType pos = ent->getPosition(); WFMath::Quaternion orientation = ent->getOrientation(); if (!orientation.isValid()) { orientation.identity(); } MovableEntity * me = dynamic_cast<MovableEntity *>(ent); if (me != NULL) { debug( std::cout << ent->getVelocity() << " " << (worldTime - me->getTime()) << " " << pos; );
void NodeController::updatePosition() { WFMath::Point<3> pos = mAttachment.getAttachedEntity().getPredictedPos(); WFMath::Quaternion orientation = mAttachment.getAttachedEntity().getOrientation(); WFMath::Vector<3> velocity = mAttachment.getAttachedEntity().getPredictedVelocity(); mAttachment.setPosition(pos.isValid() ? pos : WFMath::Point<3>::ZERO(), orientation.isValid() ? orientation : orientation.identity(), velocity.isValid() ? velocity : WFMath::Vector<3>::ZERO()); }