SFAOK
12-07-2006 16:15:46
In the tutorials you can fire cylinders from the camera using the space bar. So I've managed to setup OgreNewt within my simulation and everything works fine, with the afformentioned cylinder firing enabled.
Now the reason I want OgreNewt in my code outside of simulating physics is to have collision detection for my creature's legs. What I plan to do is physically simulate the feet of the creatures and have them 'plant' or 'anchor' themselves when they touch the landscape.
The first thing I'm trying to do is have a collision callback method that stops the space bar fired cylinders when they touch the surface, or have them turn red or whatever - in other words I want to have the code so that after the first collision with the surface, something happens in effect (which will eventually be used for the leg tips).
So I've got it setup at the moment like this :
Or in other words, when a cylinder hits the surface, 'Bang' is printed out.
Now the problem I have is that when I fire 10 cylinders off the edge of the map, and then fire the 11th onto the landscape I still get a Bang. How would I differentiate between the different cylinders? Do I need to create a different Material ID for all of them, or am I missing a trick?
How would I then access the specific object's body properties, or change its material? Any help would be great.
Now the reason I want OgreNewt in my code outside of simulating physics is to have collision detection for my creature's legs. What I plan to do is physically simulate the feet of the creatures and have them 'plant' or 'anchor' themselves when they touch the landscape.
The first thing I'm trying to do is have a collision callback method that stops the space bar fired cylinders when they touch the surface, or have them turn red or whatever - in other words I want to have the code so that after the first collision with the surface, something happens in effect (which will eventually be used for the leg tips).
So I've got it setup at the moment like this :
int collisionMatCallback::userProcess()
{
// first, find which body represents the conveyor belt!
OgreNewt::Body* object;
if (m_body0->getType() == mTestID)
{
collisionFlag = true;
}
void collisionMatCallback::userEnd()
{
if(collisionFlag == true)
cout << "\nBang!";
}
Or in other words, when a cylinder hits the surface, 'Bang' is printed out.
Now the problem I have is that when I fire 10 cylinders off the edge of the map, and then fire the 11th onto the landscape I still get a Bang. How would I differentiate between the different cylinders? Do I need to create a different Material ID for all of them, or am I missing a trick?
How would I then access the specific object's body properties, or change its material? Any help would be great.