Exemple #1
0
	const Ogre::Vector3 Mesh::getObjectSpacePosition(const Ogre::Vector3& WorldSpacePosition) const
	{
		Ogre::Matrix4 mWorldMatrix;

		if (mCreated)
		{
	#if OGRE_VERSION_MAJOR >= 1 && OGRE_VERSION_MINOR >= 7
			 mWorldMatrix = mEntity->getParentSceneNode()->_getFullTransform();
	#else
			 mEntity->getParentSceneNode()->getWorldTransforms(&mWorldMatrix);
	#endif
		}
		else
		{
			Ogre::SceneNode *mTmpSN = new Ogre::SceneNode(0);
		    mTmpSN->setPosition(mHydrax->getPosition());

	#if OGRE_VERSION_MAJOR >= 1 && OGRE_VERSION_MINOR >= 7
			 mWorldMatrix = mTmpSN->_getFullTransform();
	#else
			 mTmpSN->getWorldTransforms(&mWorldMatrix);
	#endif

		    delete mTmpSN;
		}

		return mWorldMatrix.inverseAffine().transformAffine(WorldSpacePosition);
	}
Exemple #2
0
	const Ogre::Vector3 Mesh::getObjectSpacePosition(const Ogre::Vector3& WorldSpacePosition) const
	{
		Ogre::Matrix4 mWorldMatrix;

		if (mCreated)
		{
			mWorldMatrix = mEntity->getParentSceneNode()->_getFullTransform();
		}
		else
		{
			Ogre::SceneNode *mTmpSN = new Ogre::SceneNode(0);
		    mTmpSN->setPosition(mHydrax->getPosition());

			mWorldMatrix = mTmpSN->_getFullTransform();

		    delete mTmpSN;
		}

		return mWorldMatrix.inverseAffine().transformAffine(WorldSpacePosition);
	}