irrlicht+physx rotation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
overburn
Posts: 101
Joined: Sun Nov 04, 2007 8:08 am
Location: Romania, Ploiesti

irrlicht+physx rotation

Post 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 :)
One Tequila, Two Tequila, Three Tequila, Floor.
_______________________________________
ASUS P5V-VM Ultra
Intel Pentium D930
1x 2GB DDR2 Kingmax 800mhz/533mhz mb
Leadtek PX9600GT W 512MB DDR3
200GB Maxtor HDD
lizhigang34
Posts: 49
Joined: Sun Dec 21, 2008 4:11 pm

Post 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.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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...
Image Image Image
overburn
Posts: 101
Joined: Sun Nov 04, 2007 8:08 am
Location: Romania, Ploiesti

Post 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 :)
One Tequila, Two Tequila, Three Tequila, Floor.
_______________________________________
ASUS P5V-VM Ultra
Intel Pentium D930
1x 2GB DDR2 Kingmax 800mhz/533mhz mb
Leadtek PX9600GT W 512MB DDR3
200GB Maxtor HDD
Post Reply