A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by derdragon » Thu Nov 19, 2009 2:11 pm
Is there a way for me to find out the attribute of the face hit by a NewtonWorldConvexCast? I'd like to determine what part of my tree collision my character controller is standing on and this data is stored in the face attribute data. NewtonWorldConvexCastReturnInfo contains the body hit by the cast, but when I have many different things making up a tree collision, I need more specific results.
-
derdragon
-
- Posts: 13
- Joined: Fri Aug 03, 2007 12:56 pm
by Julio Jerez » Thu Nov 19, 2009 2:32 pm
In the structure
- Code: Select all
struct NewtonWorldConvexCastReturnInfo
{
dFloat m_point[4]; // collision point in global space
dFloat m_normal[4]; // surface normal at collision point in global space
dFloat m_normalOnHitPoint[4]; // surface normal at the surface of the hit body,
// is the same as the normal calculated by a ray cast hitting the body at the hit point
dFloat m_penetration; // contact penetration at collision point
int m_contactID; // collision ID at contact point
const NewtonBody* m_hitBody; // body hit at contact point
};
contactID is the id of the shape at the conatct point.
for a collision tree it will be the ID of the face, in a compound it will be the ID of the subshape, in a hightfirldit will be the id of the cell, and so on.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by derdragon » Thu Nov 19, 2009 2:52 pm
Are you sure? All I get is 0, when I've definitely passed integers for the face attributes in NewtonTreeCollisionAddFace:
- Code: Select all
NewtonTreeCollisionAddFace(col,3,&verts[0],12,(int)D);
Also, the face attribute is correct in my collisions checks, so I'm thinking either it's an issue with the convex cast, or I'm not using it right. Thank you again for another quick response!
-
derdragon
-
- Posts: 13
- Joined: Fri Aug 03, 2007 12:56 pm
by Julio Jerez » Thu Nov 19, 2009 3:30 pm
Not I am not sure, but it is how it is supposes to work.
if it is not then it is a bug in teh engine and it nee to be resolved.
I never check that because convex cast is based on the same collision functions the collision system is based upon. But there could be a bug.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests