A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by jamesm6162 » Tue Aug 25, 2015 1:40 am
Hi
I need to have a body that can be moved around manually like a kinematic body, and collect contact points with other bodies, but does not affect the bodies it collides with.
Is it best to do it in the NewtonContactsProcess callback set using NewtonMaterialSetCollisionCallback, by rejecting the contact points, while storing them somewhere I can access them later?
How exactly do I reject contacts inside this callback, as the callback returns void.
Regards
James
-
jamesm6162
-
- Posts: 49
- Joined: Wed Aug 12, 2015 8:50 am
by Julio Jerez » Tue Aug 25, 2015 8:47 am
In the callback you can do something like this.
- Code: Select all
void* contactList[32];
for (void* contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact)) {
contactList[countCount] = contact;
countCount ++;
}
for (int i = 0; i < countCount; i++) {
NewtonContactJointRemoveContact(contactJoint, contactList[i]);
}
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by jamesm6162 » Tue Aug 25, 2015 10:48 am
Ok so you literally remove the contacts from the ContactJoint.
And this is the correct/most effective way to make a body ignore all contacts, while still saving them somewhere?
Thanks!
-
jamesm6162
-
- Posts: 49
- Joined: Wed Aug 12, 2015 8:50 am
by Julio Jerez » Tue Aug 25, 2015 11:36 am
contacts are being removed and added all the time.
the logic for disabling collision in one contact add lot of complexity. it is simpler to jus delete it.
contacts and a joint are the same thing. when you make a joint the add the same contacts.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by jamesm6162 » Wed Aug 26, 2015 1:47 am
Thanks for the help Julio
-
jamesm6162
-
- Posts: 49
- Joined: Wed Aug 12, 2015 8:50 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest