A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Eralun » Sun Sep 19, 2010 5:02 am
I'm not sure if this is possible, but I can't seem to find a way to make the character controller ignore certain collisions. I understand that simply specifying a material to it and return 0 in the collision callback won't work because the controller uses an entire different way to check for collision. But is there a way to make it ignore collisions in another way that I'm missing?
-
Eralun
-
- Posts: 3
- Joined: Sat Sep 18, 2010 11:06 am
by ledahut » Sun Sep 19, 2010 7:29 am
I don't use this controller joint, but did you try NewtonMaterialSetDefaultCollidable instead of returning 0 in the callback?
-
ledahut
-
- Posts: 98
- Joined: Mon Jun 21, 2010 8:03 am
- Location: France
by Carli » Sun Sep 19, 2010 10:13 am
/me has the same problem
-
Carli
-
- Posts: 245
- Joined: Fri Oct 02, 2009 5:28 am
by Eralun » Sun Sep 19, 2010 3:16 pm
I tried NewtonMaterialSetDefaultCollidable before... that doesn't work unfortunately. The problem is that the character controller has a collision check within the class. I'm trying to figure out how the code works but I have a hard time understanding it. From what I can understand it use a sensor shape on the position it is moving to to detect if there are any objects intersecting the shape at the new position. Then it calls the ConvexStaticCastPrefilter() function which is sort of the same as the normal onAABBOverlap() in the collision callback. Which should mean it's possible to return 0 to ignore collisions, unfortunately that doesn't seem to do the trick. Hope I'm missing something.
-
Eralun
-
- Posts: 3
- Joined: Sat Sep 18, 2010 11:06 am
by ledahut » Sun Sep 19, 2010 3:58 pm
the character controller has a collision check within the class.
What do you use? ogrenewt?
-
ledahut
-
- Posts: 98
- Joined: Mon Jun 21, 2010 8:03 am
- Location: France
by Eralun » Sun Sep 19, 2010 4:03 pm
I do use ogrenewt, and I also used its controller before. However, I got my own player controller now that derives directly from the newton CustomPlayerController since the ogrenewt one has even less flexability. But I'm totally new to newton so please correct me if I'm wrong on the assumption that CustomPlayerController uses it's own collision checking.
-
Eralun
-
- Posts: 3
- Joined: Sat Sep 18, 2010 11:06 am
by duncan » Sat Mar 26, 2011 4:33 am
can anyone solve it..

-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
by JernejL » Sat Mar 26, 2011 6:43 am
NewtonMaterialSetDefaultCollidable should be availible even in ogrenewt.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by duncan » Sat Mar 26, 2011 7:13 am
Thanks.. NewtonMaterialSetDefaultCollidable is available but even after setting it to 0, the player still can stand on a monster or lift on it...even no collision... I dont know if it is the stair effect problem of newton or problem of ogrenewt... i know many people face this problem but i never found a solution online...
-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
by JernejL » Sat Mar 26, 2011 9:58 am
you need to set material per one relation between 2 materials, so set it between player material and monster material.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by duncan » Sat Mar 26, 2011 10:35 pm
Thanks for reply
I have set the same material (mMatCharacter) for both player and monsters. And then set the material pair like this.
mMatPairCharacterCharacter = new MaterialPair( mWorld, mMatCharacter,mMatCharacter );
mMatPairCharacterCharacter->setDefaultCollidable(0);
Is here any errors... On the other hand, if i set lower the stair factor like 0.000001 when constructing the controller. The lift and standing on player problem is minimized. But there are still some blocks of player and player can stand on the monster easily....

-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
by duncan » Mon Apr 04, 2011 2:11 pm
Please help...
I want to know if it is a common problem or it's just my problem???
anyone doesn't face this problem with using player controller??
I really dont want contact of player and monsters...
or anyone got idea of controlling player and monsters without using the controller?
-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
by Julio Jerez » Mon Apr 04, 2011 2:38 pm
Are you sing the palye controller? CustomPlayerController
at the momnet the only way to filter bodies is to re write the convex cast filet funtion function
I do not know why that did not come up sooner, meay because few people are actually usind the player controller
did is is who teh funtion looks now,
- Code: Select all
unsigned CustomPlayerController::ConvexAllBodyCastPrefilter(const NewtonBody* body, const NewtonCollision* collision, void* userData)
{
CastFilterData* filterData;
filterData = (CastFilterData*) userData;
for (int i =0; i < filterData->m_count;i ++){
if (filterData->m_filter[i] == body) {
return 0;
}
}
return 1;
}
if the inner loop is change to test for some Material Id instead of for some bodies than that solve the propblem
It is very eassy to fix.
you can modify the filter yourself of you can way for me to post next SDK update.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by duncan » Sat Apr 09, 2011 2:34 pm

i am newbie.. it is hard for me~_~..
-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
by duncan » Thu Apr 14, 2011 10:21 am

Thanks Delfi and Julio. I amended the code in following way and my monsters never collide with my player any more.
In CustomPlayerController.cpp,
- Code: Select all
unsigned CustomPlayerController::ConvexAllBodyCastPrefilter(const NewtonBody* body, const NewtonCollision* collision, void* userData)
{
CastFilterData* filterData;
filterData = (CastFilterData*) userData;
for (int i =0; i < filterData->m_count;i ++){
if (filterData->m_filter[i] == body || NewtonBodyGetMaterialGroupID(body) == filterData->materialID[i]) {
return 0;
}
}
return 1;
}
In CustomPlayerController.h, materialID[8] was added to CastFilterData,
- Code: Select all
struct CastFilterData
{
CastFilterData (const NewtonBody* me)
{
m_count = 1;
m_filter[0] = me;
materialID[0] = NewtonBodyGetMaterialGroupID(me);
}
int m_count;
const NewtonBody* m_filter[8];
int materialID[8];
};
I know there should be some better solutions for this but this can solve my problem for now.

-
duncan
-
- Posts: 8
- Joined: Sat Mar 26, 2011 4:19 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 3 guests