A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by wilsonwing » Tue Jan 13, 2009 3:42 am
Hi, I am a newbie to here
I am making a game and meet some problem.
I have a object , laser.
The default collision behave is like, my laser always collides.(Laser hit laser , and can't pass through, something like this)
I tried this:( But not working )
- Code: Select all
int LaserMatCallback::userProcess()
{
if( m_body0->getType() == BT_Laser&& m_body1->getType() == BT_Laser)
return 0; // Don't collide, but not working.
else
return 1;
}
I even tried to set the material pair of my laser object mMatPair->setDefaultCollidable(0);
It collide with nothing, but only with laser objects....
Can someone help me with this
?
ps. I am actually doing this with OgreNewt( a combination of Newton with Ogre graphic engine)
But I think this problem is the physic problem so I post it here
-
wilsonwing
-
- Posts: 1
- Joined: Tue Jan 13, 2009 3:33 am
by Virginie » Thu Apr 16, 2009 9:11 am
Hey,
I use OgreNewt 2.0, Newton 2.0 and Ogre 1.6.1 and I've got a problem whith material pair and callback.
That is my material :
m_CameraMaterial = new OgreNewt::MaterialID(m_WorldCollision,0);
m_CanCollidableMaterial = new OgreNewt::MaterialID(m_WorldCollision,1);
m_NeverCollidableMaterial = new OgreNewt::MaterialID(m_WorldCollision,2);
my material pair :
m_CameraCamera = new OgreNewt::MaterialPair(m_WorldCollision,m_CameraMaterial,m_CameraMaterial);
m_CameraCanCollidable = new OgreNewt::MaterialPair(m_WorldCollision,m_CameraMaterial,m_CanCollidableMaterial);
m_CameraNeverCollidable = new OgreNewt::MaterialPair(m_WorldCollision,m_CameraMaterial,m_NeverCollidableMaterial);
m_CanCollidableCanCollidable = new OgreNewt::MaterialPair(m_WorldCollision,m_CanCollidableMaterial,m_CanCollidableMaterial);
m_CanCollidableNeverCollidable = new OgreNewt::MaterialPair(m_WorldCollision,m_CanCollidableMaterial,m_NeverCollidableMaterial);
m_NeverCollidableNeverCollidable = new OgreNewt::MaterialPair(m_WorldCollision,m_NeverCollidableMaterial,m_NeverCollidableMaterial);
ContactCallback set :
m_CameraCanCollidable->setContactCallback(m_MonCallbackCollision);
m_CanCollidableCanCollidable->setContactCallback(m_MonCallbackCollision);
collisions I want:
m_CameraCamera->setDefaultCollidable(0);
m_CameraCanCollidable->setDefaultCollidable(1);
m_CameraNeverCollidable->setDefaultCollidable(0);
m_CanCollidableCanCollidable->setDefaultCollidable(1);
m_CanCollidableNeverCollidable->setDefaultCollidable(0);
m_NeverCollidableNeverCollidable->setDefaultCollidable(0);
This compile but plants at execution.
With debug I see that is when I use setContactCallback or setDefaultCollidable, so I think that my materialpair are bad defined.
Please help me, I don't know why
-
Virginie
-
- Posts: 32
- Joined: Tue Mar 31, 2009 4:29 am
by Virginie » Tue Apr 21, 2009 4:00 am
I solve my problem : it was when I build my matérialID, the constructor with the ID have a problem so I just use newton world in parameter.
-
Virginie
-
- Posts: 32
- Joined: Tue Mar 31, 2009 4:29 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 26 guests