A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by TreantBG » Tue May 08, 2012 3:51 am
i use NewtonMaterialSetCollisionCallback to check if my missile is collide with a building, and if it does then explode the missile.
but the problem is the Callback function tells me that the missile collide with the purple rectangle around the building...

but when i remove the callback function my missile collide properly with the building but the problem is i don't know when to tell the missile to explode
any solution to the problem?
-
TreantBG
-
- Posts: 16
- Joined: Wed Apr 25, 2012 4:14 pm
by Sweenie » Tue May 08, 2012 5:09 am
Sounds like you only defined a callback for the NewtonOnAABBOverlap event.
- Code: Select all
void NewtonMaterialSetCollisionCallback (const NewtonWorld* newtonWorld, int id0, int id1, void* userData,
NewtonOnAABBOverlap aabbOverlap, NewtonContactsProcess process);
Try using the NewtonContactsProcess event instead which is called when the missile is actually hitting the collider.
NewtonOnAABBOverlap is triggered when the missile is entering the bounding box of the body as you described.
You can pass NULL for NewtonOnAABBOverlap, but if you want NewtonOnAABBOverlap to be called as well, don't forget to return 1 in that function or else
Newton won't generate any collision contacts between the two bodies(NewtonContactsProcess won't be called).
-
Sweenie
-
- Posts: 503
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by TreantBG » Tue May 08, 2012 5:55 am
ok but in NewtonContactsProcess how to take the body0 and body1??
-
TreantBG
-
- Posts: 16
- Joined: Wed Apr 25, 2012 4:14 pm
by Sweenie » Tue May 08, 2012 6:52 am
The NewtonContactsProcess will pass a NewtonJoint parameter called contact.
Use NewtonJointGetBody0(contact) and NewtonJointGetBody1(contact) to retrieve the associated bodies;
-
Sweenie
-
- Posts: 503
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by TreantBG » Tue May 08, 2012 11:02 am
im using the old Newton 1.53 and that functions doesn't exits there
any suggestions?
or should i upgrade the version?
Are the newest versions more optimized?
-
TreantBG
-
- Posts: 16
- Joined: Wed Apr 25, 2012 4:14 pm
by Stucuk » Tue May 08, 2012 11:38 am
You should upgrade. Version 1.53 is very old. Newer versions are faster, more stable and have more features.
-

Stucuk
-
- Posts: 801
- Joined: Sat Mar 12, 2005 3:54 pm
- Location: Scotland
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests