Vineeth@nxOgre
26-03-2008 06:38:50
how dop i do it .I want to place the mouse on the pressurized cloth and then press the left button of mouse and then the particular vertex should be pulled untill it tears .
I was working with glut in ageia and it had
What can I add in the onframe method of cake box.How can i work with
ogre .i know get mousestate().mousebutton and iskeyreleased.But just anyone please help me out with this
I was working with glut in ageia and it had
ool PickCloth(int x, int y)
{
NxRay ray;
ViewUnProject(x,y,0.0f, ray.orig);
ViewUnProject(x,y,1.0f, ray.dir);
ray.dir -= ray.orig; ray.dir.normalize();
NxVec3 hit;
NxU32 vertexId;
gSelectedClothVertex = -1;
NxReal distance = NX_MAX_REAL;
NxCloth **cloths = gScene->getCloths();
for (NxU32 i = 0; i < gScene->getNbCloths(); i++) {
if (cloths[i]->raycast(ray, hit, vertexId)) {
if(hit.magnitude() < distance)
{
#if 1
gSelectedCloth = cloths[i];
gSelectedClothVertex = vertexId;
int hitx, hity;
ViewProject(hit, hitx, hity, gMouseDepth);
distance = hit.magnitude();
#else
cloths[i]->wakeUp();
cloths[i]->tearVertex(vertexId, NxVec3(0,1,0));
cloths[i]->tearVertex(vertexId, NxVec3(1,0,0));
#endif
}
}
}
return distance < NX_MAX_REAL;
}
// ------------------------------------------------------------------------------------
void MoveCloth(int x, int y)
{
if (gSelectedCloth && gSelectedClothVertex >= 0) {
NxVec3 pos;
ViewUnProject(x,y, gMouseDepth, pos);
gSelectedCloth->attachVertexToGlobalPosition(gSelectedClothVertex, pos);
}
}
What can I add in the onframe method of cake box.How can i work with
ogre .i know get mousestate().mousebutton and iskeyreleased.But just anyone please help me out with this