PhysX raycast problem: Retrieving only one collision group

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

PhysX raycast problem: Retrieving only one collision group

Post by shadowslair »

OK, here`s what makes me suffer for over a week... :(

The problem is that when I try to check the group of the returned by the raycast object, it always returns 1 (for GROUP_1_LEVEL - see below).
Somehow it`s not recognising the groups of the other Rigids. Their groups are assigned properly in their create events for sure.

First of all I create some PhysX collision groups, `cause I find it useful:

Code: Select all

enum COLLISION_GROUPS
{
	GROUP_0_NOCOLLISION,
	GROUP_1_LEVEL,
	GROUP_2_CHARACTER,
	GROUP_3_OBJECTS     //group for checking shootable objects 
};
I pass two vectors-origin and direction and defdist value for default distance to check.

Than I create my Raycast like this:

Code: Select all

{

	
      NxShape* shape = Scene->raycastClosestShape(
                  worldRay, 
                  NX_ALL_SHAPES, 
                  hit,
                  GROUP_2_CHARACTER, 
                  defdist);
}
// since the origin of the raycast is in the character`s collision volume
// I ignore it to avoid commiting a suicide =)
So, the question for a million bucks ( not literally ) :D is what am I doin` wrong?

I did my best to arrange the code, because by simply pasting here makes a mess, and tried to focus on the problematic function. The problem may be somewhere otside, so if you wanna know sth in particular, feel free to ask. :roll:

EDIT: I moved the topic from the Beginners section[/code]
Last edited by shadowslair on Mon May 12, 2008 1:31 pm, edited 1 time in total.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Well one thing I would recommend is possibly using the shape that is returned by the raycast function instead of using NxRaycastHit. And if that doesn't work, then you could possibly try out raycast reports.
TheQuestion = 2B || !2B
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Thanks.

So, how it will look like? I don`t got it.

How will I return any value than?

( have to mention that chatting for three hours in the IRC drives me crazy )
:D

Ahhh. Something like:

not hit. (...) but shape. (...) , is that right?
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Well it is actually described in this PhysX tutorial.
TheQuestion = 2B || !2B
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

I got it working! Not exactly as I wanted, but will do it. Using shape->getGroup is working the same as hit.shape->getGroup, but you gave me an idea. I think I`ll suceed doin` it.

Thanks alot, Halifax!!!
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Post Reply