Newbie Help - Glut Render Call Back Function
I am currently trying to create a few simple simulations in C++ and PhysX for a project i'm working on, and whilst the simulations run perfectly fine at the moment, I am creating an
additional box, that sits at the origin and that other boxes just seem to pass through.
Any ideas why I'm getting an extra rendered box that doesn't obey the collision laws that i placed upon the other boxes? Sample code for the render actors within RenderCallBack is below:
.....
// Render all actors
int nbActors = gScene->getNbActors();
NxActor** actors = gScene->getActors();
while(nbActors--)
{
NxActor* actor = *actors++;
// Render actor
glPushMatrix();
float glMat[16];
actor->getGlobalPose().getColumnMajor44(glMat);
glMultMatrixf(glMat);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glScalef (0.5,4.0,1.0);
glutSolidCube(1.0);
glPopMatrix();
}
.......
Thanks!
Yeah, I understand where you might think that it's an obvious question, and to be honest I'm not sure if the number of Actors is correct.
When I run the simulation, which is expected to create a row of 10 boxes and drop them, the counter always indicates that there are 11 actors present.
Now the NxActors, does that include the ground plane? Because if not then i suppose I would just need to reduce the creation of actors by one count. I have tried that as well, but I still create that random box, and just produce one less box of the ones i want to create :(
When I run the simulation, which is expected to create a row of 10 boxes and drop them, the counter always indicates that there are 11 actors present.
Now the NxActors, does that include the ground plane? Because if not then i suppose I would just need to reduce the creation of actors by one count. I have tried that as well, but I still create that random box, and just produce one less box of the ones i want to create :(
I'm not familiar with PhysX (unfortunately). Can you access information about the actor from the actor pointer? That is, can you test if the actor is a box or a plane? Most collision systems have some method to set and get the category or type of a collision object.
If so, do that test in your render loop and skip the renders you don't want.
If so, do that test in your render loop and skip the renders you don't want.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement