Page 1 of 1

irrlicht+physx rotation

Posted: Sat Apr 04, 2009 9:54 am
by overburn
ok i have the following problem.
when i try to rotate a mesh, it simply doesn't rotate
this is the code :

Code: Select all

void addTunnelMesh(systemRoot *root,const irr::c8 *fname,core::vector3df pos,core::vector3df rot,core::vector3df scale)
{
	scene::IAnimatedMesh* levelmesh=root->vsmgr->getMesh(fname);
	if(levelmesh)
	{
	root->vsmgr->getMeshManipulator()->makePlanarTextureMapping(levelmesh->getMesh(0),1.0f);
	//scene::IAnimatedMeshSceneNode* level=device->getSceneManager()->addAnimatedMeshSceneNode(levelmesh);
	scene::ISceneNode* level=root->vsmgr->addMeshSceneNode(levelmesh->getMesh(0));
	level->setScale(scale);
	level->setPosition(pos);
	level->setRotation(rot);
	std::cout<<level->getRotation().X<<" "<<level->getRotation().Y<<" "<<level->getRotation().Z<<" "<<std::endl;
	level->getMaterial(0).setFlag(video::EMF_LIGHTING,false);
	level->getMaterial(0).setFlag(video::EMF_NORMALIZE_NORMALS,true);
	level->getMaterial(0).setFlag(video::EMF_BACK_FACE_CULLING,false);
	level->getMaterial(0).setFlag(video::EMF_ANISOTROPIC_FILTER,true);
	level->getMaterial(0).setTexture(0,root->vdriver->getTexture("tex.bmp"));
	NxActor* level_actor=root->CreateTriMesh(levelmesh->getMesh(0),"t1.pmap",32,pos,scale,0);
	Nodes.push_back(new EntNode(level_actor,level,1));
	}
}

Code: Select all

addTunnelMesh(root,"tp1.3ds",core::vector3df(0,0,4),core::vector3df(25,25,0),core::vector3df(1,1,1));
anyone know what's happening ? thanks :)

Posted: Sun Apr 05, 2009 4:48 am
by lizhigang34
Hi,here is the IrrPhysX written by JP.It may be useful for you.
http://irrlicht.sourceforge.net/phpBB2/ ... 0f71447a69
About rotate an actor,my code snippet as follows.

Code: Select all

void setRotate(vector3df rot)
{
    NxMat33 mat;
    NxMat33 rotX, rotY, rotZ;
    rotX.rotX(rot.X * core::DEGTORAD);
    rotY.rotY(rot.Y * core::DEGTORAD);
    rotZ.rotZ(rot.Z * core::DEGTORAD);
    mat = rotZ * rotY * rotX;
    m_pActor->setGlobalOrientation(mat);	
}
hope it is helpful for you,and thanks JP.

Posted: Mon Apr 06, 2009 4:43 pm
by JP
Your code doesn't even apply the rotation to the physx node, overburn :lol:

Are you trying to constantly update the rotation or just do a one-off update? I just can't get physx objects to rotate constantly... really doing my nut in...

Posted: Tue Apr 07, 2009 6:16 pm
by overburn
problem solved... started from scratch :)
anyways, i was rotating the irrlicht node , but the physx node's rotation wasn't updating because i didn't check a parameter :)

btw... if i use physx , i should manipulate the node only from physx?

and thanx :)