子节点(ChildNode)设置WorldPostion

if(m_SceneManager->hasEntity("knot"))
	{

		Entity *pent=m_SceneManager->getEntity("knot");
		SceneNode *parentNode=pent->getParentSceneNode();
	//	SceneNode *parentNode=m_SceneManager->getRootSceneNode();
		SceneNode *pNode=parentNode->createChildSceneNode();

		static int newentflag=0;
		newentflag++;
		String name="newentflag_"+StringConverter::toString(newentflag);
		Entity *newEnt=m_SceneManager->createEntity(name,"sphere.mesh");
		pNode->attachObject(newEnt);
		pNode->setPosition(parentNode->_getDerivedOrientation().Inverse()*(pt-parentNode->getPosition())/parentNode->getScale());
		pNode->setScale(0.01,0.01,0.01);
	}

childNode->setPosition(ParentNode->_getDerivedOrientation().Inverse()*(需要设置的WorldPostion-parentNode->getPosition())/parentNode->getScale());

你可能感兴趣的:(子节点(ChildNode)设置WorldPostion)